Skip to main content

All Questions

Tagged with
13 votes
3 answers
26k views

react-leaflet get current latlng onClick

I would be realy happy if some one could help me... I've installed react-leaflet on my react project and the map component is loaded successfully, i need to get current latlng and show it in the Popup ...
Maryam Alishahi's user avatar
13 votes
2 answers
3k views

How to prevent event bubbling on child of React-Leaflet Map

I have a React-Leaflet map which I am rendering a div inside. For some reason, interacting with the contents of the div causes the map beneath to respond (eg: double-clicking will zoom the map, ...
Alex McMillan's user avatar
12 votes
2 answers
14k views

How to get bounds with react-leaflet

I want to get bounds of the current map so that I can search those bounds with the Overpass API. For leaflet I know the method is just map.getBounds(), but I don't know how to implement that in react-...
Jake Hm's user avatar
  • 337
10 votes
3 answers
9k views

Implementing a dynamic JSX element within a marker, using react-leaflet

I have a React app in which I am using Leaflet through react-leaflet, both super useful libraries. In this app, I have a group of coordinates that need to be rendered as follows: When zoomed out, ...
nikjohn's user avatar
  • 21.1k
10 votes
1 answer
3k views

React leaflet draw - marker icon and drag handler is missing

I am using react leaflet draw for drawing polygons and circles. But when I chose edit polygon there is no drag handler for a move and resize. How to solve this issue if any one have the same? This ...
Stevan Tosic's user avatar
  • 7,029
9 votes
1 answer
13k views

How to locate react-leaflet map to user's current position and get the borders for this map?

I need to locate react-leaflet map to user's current position and get the borders for this map. I tried to apply the following code, but faced the error: TypeError: Cannot read property 'locate' of ...
Helen's user avatar
  • 187
9 votes
1 answer
5k views

componentDidUpdate prevProps gives me current / new props

I'm trying to integrate a leaflet map but I think that is not the problem here. Anyway to re-render my map I want to use componentDidUpdate to see if the props changed I pass down to my map component ...
Mar's user avatar
  • 1,129
8 votes
2 answers
4k views

Pass A react component to leaflet popup

I am using leaflet in my react code and I am not using react-leaflet. I want to pass a react component or jsx code to binbPopup function to every tooltip. let marker = new L.marker(...).bindPopup(<...
Hadi Ranjbar's user avatar
  • 1,792
8 votes
1 answer
5k views

Using leaflet.offline with React?

I'm developing a React app, and I'm trying to implement a Leaflet-map with support for offline download of the map tiles. For this I thought of using leaflet.offline (https://github.com/allartk/...
Tmfwang's user avatar
  • 650
8 votes
1 answer
6k views

React-leaflet geojson onEachFeature popup with custom react component

I am trying to render custom react component in react-leaflet GeoJSON onEachFeature popup, e.g. to fire modal with all corresponding feature.properties. In a popup react-leaflet component it works ...
astricus's user avatar
8 votes
3 answers
14k views

Uncaught Error: No context provided: useLeafletContext() can only be used in a descendant of <MapContainer> [duplicate]

I'm using react-leaflet and I added a marker with an event Handler on click to zoom to this marker , but when I try to use const map=useMap() all I get is this error => : Uncaught Error: No context ...
Firas SCMP's user avatar
8 votes
2 answers
3k views

Add leaflet plugins to React-Leaflet

I'm trying to create a custom component in react-leaflet v2 extending a leaflet plugin EdgeMarker. The documentation does not really give details on how to do this. So I have copied the Leaflet....
danyhiol's user avatar
  • 669
7 votes
2 answers
18k views

Change Center position of React leaflet map

So what I'm trying to do is, I want to change the center of map after I get the users lat and lng, the code below will make the problem clearer: <LeafletMap center={this.state.UserCurrentPosition}...
the preacher's user avatar
7 votes
4 answers
2k views

React-leaflet map shows scattered blocks of maps

I was trying to show a sample map on my react website. I have installed the leaflet package and also the react-leaflet package then set everything up as the react-leaflet document said to do. You can ...
Nafi's user avatar
  • 129
7 votes
2 answers
3k views

React-leaflet how to resetStyle

I'm following Leaflet's Choropleth tutorial http://leafletjs.com/examples/choropleth.html and using react-leaflet. I managed to setStyle without any modification from the original source code and it ...
Alex Parij's user avatar
  • 1,246

15 30 50 per page
1
2
3 4 5
74