Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

0 votes
0 answers
38 views

How to dynamically use fallback tiles from the previous zoom level of the same server in Leaflet?

I'm working on a mapping application using React with Leaflet for tile rendering. When tiles fail to load (due to network issues, server downtime, tiles not available), I want to dynamically use ...
Shrutika Maske's user avatar
0 votes
1 answer
107 views

Getting the clicked marker in react leaflet

So I have my leaflet map in my react project, I have markers on this map and I want to get the marker clicked. I want to show this markers popUp info on a side panel. How would I get the marker ...
canadianbleach's user avatar
0 votes
1 answer
78 views

changing cluster's styles not working with lazy loading leaflet in SSR react application

I'm encountering some challenges with lazy loading a Leaflet map in a React application deployed on a server-side rendering (SSR) environment. The application involves loading a list of products in a ...
Ehsan Zand's user avatar
0 votes
0 answers
77 views

React-leaflet doesn't clear routes when adding additional waypoints

I'm trying to clear the route when I add a new waypoint. Only two waypoints should should show. However, when adding an additional waypoint, Leaflet will show the old route instead of clearing it. I ...
Christopher Lam's user avatar
0 votes
1 answer
780 views

How to cluster polygons with react-leaflet?

I'm looking for a way to cluster polygons using react-leaflet v4 and react-leaflet-markercluster. I have not found any up-to-date examples of how I can achieve this, so I'm hoping I might get some ...
steinway's user avatar
1 vote
1 answer
476 views

NextJS and persist layout that contains Leaflet

I'm migrating a project from React to NextJS which has a layout where the common component is a Leaflet Map. In Next JS, the "next/dynamic" used to load the map React used react-router-dom@...
FlickDUB's user avatar
1 vote
1 answer
690 views

How To Use Leaflet.markercluster in a Layer Group

So I'm trying to group my markers on my Leaflet Map using Leaflet.markercluster. Currently, I add my markers using a child in my MapContainer in my App() function: return ( <MapContainer ....
Gregory's user avatar
  • 25
5 votes
3 answers
5k views

react-leaflet-markercluster is not working

I'am trying to use react-leaflet-markercluster, but after I add <MarkerClusterGroup> to the code, errors are displayed in the console and the page does not load. If this component is not added, ...
Akhtem Aliiev's user avatar
1 vote
1 answer
2k views

Custom icons for MarkerClusters in React Leaflet

I am trying to implement a custom icon for my markerclusters (instead of the regular circular clusters). I referred to the link and implemented as shown in the code below: https://www.npmjs.com/...
Aahana B.'s user avatar
5 votes
6 answers
8k views

useLeafletContext() can only be used in a descendant of <MapContainer>

I am in the process of converting a leaflet-map in React into a hook with the use of react-leaflet and react-leaflet-markercluster. Everything worked perfectly except the use of the MarkerCluster ...
julziemoon's user avatar
1 vote
2 answers
4k views

react-leaflet: Clear marker cluster before rendering new markers

TLDR; Is there a way to clear all markers from a marker cluster using react-leaflet and react-leaflet-markercluster? EDIT: Yes, there is! I just added a key prop to the MarkerClusterGroup, as @...
Lucas Bueno Cesario's user avatar
1 vote
2 answers
1k views

How to remove marker from markercluster

I am using React Leaflet and react-leaflet-markercluster. I have a lot of markers and if parent's state is changed, marker cluster rerendering takes longer time. For this reason, cluster components ...
Matt's user avatar
  • 8,763
2 votes
1 answer
1k views

Performance issues if MapComponent state is updated

I am not sure if this is an issue of react-leaflet-markercluster, react-leaflet, leaflet, react, or my code. I have a map with several thousand markers and I am using react-leaflet-markercluster for ...
Matt's user avatar
  • 8,763
1 vote
1 answer
739 views

How pass props to React Leaflet.markercluster options since v2.0.0?

I tried to pass property with <MarkerClusterGroup {...markerclusterOptions}> by let markerclusterOptions but i think it is not a good way, because it does not work! in documentation (# React ...
MaaGik's user avatar
  • 13
6 votes
0 answers
2k views

Leaflet map with react-leaflet-markercluster cluster spiderfy's or closes onClick

I have a Leaflet map in React using react-leaflet and react-leaflet-markercluster Clustering seems to work beautifully, but if I click on one of the cluster CircleMarker or Tooltip it opens a new ...
 Rolo Tomasi's user avatar
0 votes
1 answer
448 views

React Js: Type Error React-Leaflet When i used first cordinate for marker

I am trying to display marker on React-Leaflet map using coordinates when i used first and last index of poly-line coordinates to display on marker and i am getting type error all the time I don't ...
Piotr's user avatar
  • 145
-1 votes
2 answers
9k views

Marker Clustering (Leaflet.markercluster) with react-leaflet 2.0

Trying to get Leaflet.markercluster working with react-leaflet 2. https://github.com/OpenGov/react-leaflet-cluster-layer does not appear to be compatible with 2.x. Any example code to get me started ...
Tim Kelty's user avatar
  • 261
1 vote
1 answer
984 views

How to fix 'TypeError: leaflet__WEBPACK_IMPORTED_MODULE_7___default.a.markerClusterGroup is not a function'

I am trying to implement marker cluster on my multiple markers but I keep getting type error. TypeError: leaflet__WEBPACK_IMPORTED_MODULE_7___default.a.markerClusterGroup is not a function this....
Birat's user avatar
  • 85
0 votes
1 answer
3k views

map.addLayer(markerClusters) is not a function

I get this error: map.addLayer(markerClusters) is not a function in for my markerClusters since I updated the following packages: "leaflet": "^0.7.7", "leaflet.markercluster": "^0.5.0", "react-...
Michael Ploeckinger's user avatar