Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
Is there a way to take a screenshot of the map with views inside with react-leftlet?

I was trying to take a screenshot of a map on react-leflet but any library i tried didn't work because they require to use preferCanvas=true option, which i can't use because it doesn't render the image correctly.

Here is my snippet

import {useState} from "react";
import {useSelector} from "react-redux";
import {MapContainer, TileLayer} from "react-leaflet";
import {mapLimit, parisCoordinates} from "../Utils/constants";

import '../Styles/MapMenu.scss'

const MapContainerBox = () => {
    const [gridShow, setGridShow] = useState(false)
    const [stationShow, setStationShow] = useState(false)

    return (
        <MapContainer center={[22,0]}
                            zoom={3}
                            minZoom={1.5}
                            scrollWheelZoom={true}
                            style={{height: '80vh'}}
                            maxBounds={mapLimit}>
            <TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
            {stationShow ? <GroundStationVisualizer curStation={parisCoordinates}/> : null}
            {gridShow ? <MapGridVisualizer/> : null}
            <div className={'map-menu'}>
                <button onClick={() => setGridShow(!gridShow)}>Toggle Grid</button>
                <button onClick={() => setStationShow(!stationShow)}>Toggle Station</button>
            </div>
        </MapContainer>
    )
}

export default MapContainerBox;

Is there a way to take a screenshot without using the canvas option?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!