1

I have a problem, because sometimes on my GeoJSON layer plotted into the Leaflet map more than 1 placemarks has been assigned to one exact location (by postcode).

The problem is, that only one of them is visible, whereas there is at least 3-4 another ones.

For example in Google Earth the problem is solved like this: when you hover one placemark, then you can see another ones hidden under the same location, as per in the picture below:

enter image description here

In leaflet this situation not occur and I see only 1 placemark only instead.

I was searching some stuff regarding to this problem and found a following examples:

http://jawj.github.io/OverlappingMarkerSpiderfier-Leaflet/demo.html

https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet

http://ivansanchez.github.io/Leaflet.Marker.Stack/demos/color_ramps.html

https://stackoverflow.com/questions/50813139/leaflet-map-with-multiple-marker-on-exact-same-position

but they don't really solve this problem

In turn, the links below:

https://stackoverflow.com/questions/22168558/multiple-marker-on-exact-same-position-on-a-leaflet-map/22173475

they are focused on the markercluster, which I don't need.

My situation looks like this:

enter image description here

where as you can see (after the onclick marker trigger) you see 2 jobs on the same location, whereas only 1 appear (always the same in addition).

Could you give me some hint, what should I tweak in the code, to make it pretty much the same, as it's in Google Earth?

  • 2
    You say that you don't need markercluster - why are you so sure of that? IMO it's the easiest way to display custom symbols (e.g. concatenating IDs) from overlapping data. See also leafletjs.com/plugins.html#clusteringdecluttering for completeness. – IvanSanchez Nov 6 at 15:36
  • I would rather to achieve the effect like here: gis.stackexchange.com/questions/249743/… where is something like spiderfy effect in the image attached. How can I achieve it? – Mariusz Krukar Nov 6 at 16:10
  • The answer to that is "with MarkerCluster". – IvanSanchez Nov 6 at 16:16
  • I know, but the image shown with this circle-looking markers is good for me and I would like to achieve that instead of marker cluster. Is that possible? – Mariusz Krukar Nov 6 at 16:31
  • 1
    It's possible, but I bet that it'll take several times more effort, time and custom code than just using MarkerCluster. (i.e. rolling out your own cluster-like algorithm to detect data points close enough to each other and do a custom spiderify-like display). Also, note that the question you linked to is about MarkerCluster. – IvanSanchez Nov 6 at 18:37
1

Finally I used leaflet-markercluster plugin and implemented into my GeoJSON layers as per the example below:

https://jsfiddle.net/m6jr7e0p/

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.