Please add support for multiple pins in the same location. Currently, if multiple pins have the exact same coordinates, or even every similar coordinates, it is impossible to select all but the top most pin. I see that there is an option in the view settings to add clustering, but the pins stay clustered at all zoom levels in the case of identical coordinates, so this is not a solution.

My recommendation is to add support for the Overlapping Marker Spiderfier plugin to have the pins separate when selected. The details of the plugin can be found here:
https://github.com/jawj/OverlappingMarkerSpiderfier

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eagilson created an issue. See original summary.

DanieleN’s picture

+1 same here.

Ruslan Piskarov’s picture

+1 same here.

DanieleN’s picture

I've tested quickly a possible implementation.
I am of the opinion that it could be more difficult to add overlappingmarkerspiderfier without rewriting big parts in the code (in the javascript files). It can be that I'm simply on the wrong path.

A simpler solution could be that we:

  1. check if has markers with identical position
  2. move a little bit the markers (change the Latitude and Longitude

Maybe you have another idea?

Ruslan Piskarov’s picture

Hello, DNicastro.
I like your another solution.
We can implement a similar to https://stackoverflow.com/questions/20490654/more-than-one-marker-on-sam....
What do you think about?

eagilson’s picture

I think that offsetting pins could work. Though the mathematics of that could get complicated if there are lots of stacked pins or nearby pins.

My initial plan was to search in the code for where the group map pins checkbox was created and enabled. Then try to add the spiderfy in a similar way. Though I have not had time to look at the code yet to check its feasibility.

ChristianAdamski’s picture

Just saying: there is already MarkerCluster support.

eagilson’s picture

Marker Cluster does not solve the problem. Consider a case where two or more pins have the exact same coordinates. In this case the Marker Cluster exists for all zoom levels. Additionally, clicking on the Marker Cluster does not bring up information on any of the pins in the cluster. So with Marker Cluster enabled, none of the stacked pins can be selected. Without Marker Cluster, only one can, the pin the map places on top. Spiderfy would enable the selection of any of the pins in the stack.

DiDebru’s picture

1+ same here

All I could so far is to solve the cluster vanish problem by adding a maxZoom property to

before:

new MarkerClusterer(
            geolocationMap.googleMap,
            geolocationMap.mapMarkers,
            {
              imagePath: imagePath,
              styles: markerClustererStyles
            }
          );

after:

new MarkerClusterer(
            geolocationMap.googleMap,
            geolocationMap.mapMarkers,
            {
              imagePath: imagePath,
              styles: markerClustererStyles,
              maxZoom: 15,
            }
          );
hanoii’s picture

While this doesn't fix the issue, #2906266: Allow for any MarkerClusterer options, not just styles allows for setting up maxZoom properly along other options.

I might work on a possible solution for this as I think I'll need it. I think a solution could be done by grouping data, assuming the lat/long is exactly the same.

hanoii’s picture

Status: Active » Needs review
FileSize
8.35 KB

Actually, I got to work on this and kind of added OverlappingMarkerSpiderfier to google maps.

The patch also adds a Max Zoom setting to marker clusterer.

Please review.

DiDebru’s picture

FileSize
163.12 KB
66.24 KB

Does not work for me, I just see 1 marker on a 14 marker cluster.

hanoii’s picture

@Insasse I assume you enabled it on the views display settings, right? The patch brings in the option to enable it the same as with marker clusterer.

hanoii’s picture

And in case you did.. can you dig a bit deeper into it. Is there a JS error. Can you confirm the OSM library is being loaded, etc.

hanoii’s picture

Ah, and one more thing, you need to clear cache, so that the new library is picked up. That could have been.

DiDebru’s picture

Missed to enabled it in the view :) thanks now it works but it looks a bit uncommon now. When there are multiple markers for same location a single marker is shown and you have to click on it to spiderfie it but as a normal user I would not know there are multiple markers.

DiDebru’s picture

FileSize
31.05 KB
27.36 KB
DiDebru’s picture

Maybe we should use the markerclusterer image there, too?

hanoii’s picture

Hmm. We are gonna face tons of custom cases where one will want something else. OMS supports certain customizations through js events so as long as things can be done outside of the module, I don't think we should be adding extra logic to this patch. I might, though, come up with a simple + sign or something if its easy, but then again, I still think the logic should be kept as simple as possible and left customizations for the theme/site side of things.

hanoii’s picture

FileSize
8.17 KB

re roll

ChristianAdamski’s picture

Just FYI: This is included in the not-yet-public 8.x-2.x branch. I modified this to 1.) respect existing Marker icons and 2.) use a designated MarkerIcon with a "+" in it, to signify markers that will split up if clicked.

ChristianAdamski’s picture

@Insasse, I'm also at Vienna and will do a BoF tomorrow from 12-13 :)

ChristianAdamski’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Needs review » Fixed

This is done in 8.x-2.x.

@hanoii - I kind of used your patch, but completely split it up, altered and extended it. I still will add you as a comitter, I simply technically don't know how yet.

ChristianAdamski’s picture

Ah, that was easier than expected. It's technically an empty commit, but it should still count.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.