I've gone through a huge number of threads discussing this matter but haven't found any that show a solution that works perfectly. I just wanted to see if anyone here could post a response in this thread that would give me what the current best solution available is to this matter. I also wanted to see if the solution is something that is easily implemented or not.

On the project I am working on now, the client has said that if I can't get multiple listings using the same location can't be differentiated and displayed in some way on the map, then we'll have to abandon the events map effort. I'd rather not have to do that because I want to be able to deliver on this.

I tried Martin Pearman's ClusterMarker, but the clustering on that was too aggressive in the wide view, clustering any events that were remotely close to each other on the map. I *only* want clustering if the events are in the identical lat/long coordinates. I don't want or need it otherwise. Plus when I zoomed by clicking on the cluster in Martin Pearman's marker manager, it only showed one event on that location. So that didn't do anything to solve the single problem I'm having unless I just don't know what I'm doing with configuring things (a distinct possibility as this is my first effort trying any marker managers).

The only thing I need is for a selection of ALL events that are on the single location represented by the marker to show up in the popup bubble instead of the information about the one event displayed. We may have 5-10 events marked at the same location at any given time, so only getting to see information about one of them isn't going to work. Then it would be majorly nice if people could click on the event they want to see within what I'd like to see appear in the bubble, and then the information for that single event would appear in the bubble. But that's just a luxury request. The necessity is for all events in the single location to display in some way when people click on the marker. I only want the solution to apply to events in the same precise location.

If this problem has been solved already and I just haven't found the solution, please let me know what I need to do. Also, the simpler the instructions can be on this, the better for novices with GMap like me. Thanks for all your work on this great module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wildlife’s picture

Correction: I'm not seeing an edit option for my post, so I wanted to correct one sentence to read:

On the project I am working on now, the client has said that if multiple listings using the same location can't be differentiated and displayed in some way on the map, then we'll have to abandon the events map effort.

jessia’s picture

Have you found a solution to this yet? I am having the same problem—in my case, I am geotagging photos and blogs using geocoded values, so there are a lot of nodes added from identical lat/long coordinates.

mry4n’s picture

I'm in a similar position, where I'd like all the nodes in one location to show up in the infowindow.

I've found that all the different clusterers do a piece of what I want, but not all of it.

You may find this patch is useful: http://drupal.org/node/284481

However, that solution does not dump everything into the infowindow.

Jef Poskanzer's Clusterer marker manager puts the nodes that are in the cluster into the infowindow, but there is no setting to only cluster on nodes with the exact same lat/lon. In fact, none of the clusterers have an option to cluster only on identical lat/lon. I'm sure there is a way to alter any of the clusterer javascript files and make that the level of sensitivity for clustering, but I haven't figured out how to do that yet.

wildlife’s picture

No solution yet. We're considering putting out a bounty to get this functionality implemented as the events map we want will be useless if there is no way to show multiple events at the same location. But I'm waiting for final approval before posting the bounty and the amount we'll be willing/able to pay.

wildlife’s picture

We would like to provide a $300 bounty for anyone that can upgrade the GMap module to have the functionality we need for multiple events at the same location.

What we need is for there to be a single marker on the location as currently shows (not necessarily a clustered marker but a marker that is different from the usual markers in some way where people will know or can be told that the different marker means multiple events at that location), but on occasions where there are multiple events in that one location, the popup that appears when you click on the marker should only show a list of all the event titles for that location. Then when people click on any of those titles, the usual pop-up information for the single events will appear along with a way to get back to the list of event titles for that location.

This is the first time I've posted a bounty on the Drupal site, so please let me know if there's an established protocol for doing so that I need to follow. I thought I would first post it in this issues area to give the module author(s) the first opportunity with it. Please reply here if you are interested in working on this for us and we'll work out whatever details are necessary for payment upon completion of the work. If this gets no response here, should I post it in the paid services forum next? If so, then would the person doing the work know what to do to get the upgrade here for others to be able to use?

If anyone would like to add any amount to our bounty offer to further expedite getting this done, feel free to jump in.

lookatthosemoose’s picture

wildlife - There is a version 2 of Martin Pearman's MarkerClusterer. See an example here:
http://developer.martinpearman.co.uk/phpfusion7/infusions/google_my_maps...
(check out the blue + symbols)
That's pretty much the functionality we're looking for.

You can download the code here:
http://developer.martinpearman.co.uk/phpfusion7/downloads.php?cat_id=1

The last entry in the new section of Martin's blog (Jan 2010) says that v2 is still unfinished.

I too am working on integrating this with the GMAPS module. I haven't yet tested this v2 w/ the GMAPS module, but will start experimenting soon. I will PM you with an idea.

wildlife’s picture

This is very close. When you hover on the + symbol, where it says the number of locations clustered is great. Then when you click on the + symbol, where it says "Show # links" is fine. I don't really need the "Fit map to location" or "Zoom in" options here. So really the "Show # links" ideally would just go straight to that popup rather than showing these three options. The popup that shows the titles of the locations is perfect. Then when you click on the location link, it brings up the popup for that location. That's perfect. I don't need the info about the location not unclustering that is present in the individual location popups though. But I'm sure that can be modified.

I'm doing the mapping for events. My event popup that comes up is generated through Views and has all the fields that I want showing set up. But what I would like, if possible, is something on the individual event popup that will give people the option to go back to the popup showing all the titles of the events without them having to close out the popup and start over again by clicking on the location.

I'll respond to your other message via e-mail in a bit.

thecodecutter’s picture

Hello all,

Did anyone manage to resolve this? I have been asked to prove similar functionality regarding multiple events at a location and my Google search has landed me here.

wildlife’s picture

We have a solution for this. One of the people that responded to our bounty has provided a new marker.js file that handles this functionality exactly as we want it. I'll get him to post his work in this thread.

Bounty on this is now closed.

izmeez’s picture

subscribing

sukr_s’s picture

Status: Active » Needs review
FileSize
5.56 KB

With some modification to the solution provided to ensure multi-language support.

lookatthosemoose’s picture

sukr_s, wildlife:

Great work on this. I've applied the patch to gmap/js/marker.js and I see the desired behavior. Attached is a screenshot for everyone's reference (screens show behavior at max-zoom level). It makes sense that these changes have to take place one level above the third party marker clusterer.

Also, for everyone's reference, I am using this in conjunction with Martin Pearman's ClusterMarker for some other desired behavior.

sukr_s’s picture

@lookatthosemoose: you can confirm that this is working by changing the status to "reviewed and tested by community", only after which the module maintainers can push this into the module.

rickyd1’s picture

FileSize
10.06 KB
2.82 KB

I am testing this patch out. However, there is no list below the text.

Is there a required field?

I have the title field in my list of fields, but it still doesn't show up in the list.

I have included the HTML and a screen shot.

rickyd1’s picture

FileSize
29.98 KB

Oops wrong image..

ikeigenwijs’s picture

It sounds greet, but i cant get it to work.

I applied the patch, so far so good.

Witch settings are to be set in gmap setting spage to get this enabled?
I tried all combinations.

pleas advice.
thx a lot.

sukr_s’s picture

@rickyd1 & ikeigenwijs:

The tooltips needs to be set for the gmap row style.
View -> edit -> row style -> gmap -> settings (small gear icon once you have chosen the gmap row style) -> select "Display a tooltip when hovering over markers" -> choose the node title (assuming that your fields has Node: Title selected).

ikeigenwijs’s picture

he thx for the help.
But i did all that and i get only 1 title instead of all the ones on that location.

Whitch setting needs to be on admin/settings/gmap ?

No manager (use GMap API directly)
Google's GMarkerManager
GMaps Utility Library MarkerManager
GMaps Utility Library MarkerClusterer
Jef Poskanzer's Clusterer
Martin Pearman's ClusterMarker

I have all of them
thx a lot

sukr_s’s picture

I use with No manger option. I have not changed anything after the module was installed.

ikeigenwijs’s picture

I tried that option and all the others.
But i have still only 1 tooltip on the vieuw.
When i know there are more than 1 node on the same location.

Can you sent me your version?

thx a lot.

sukr_s’s picture

FileSize
3.65 KB

I've attached my view definition. note that i have used the story content type. you'll have to adjust this. also to be very sure you may want to create two nodes with exactly the same lat/log, even a digit less / more / different will not work. if this does not help, attach your view definition and the marker.js
----------------------------------------------
http://www.drupalfx.com

ikeigenwijs’s picture

FileSize
9.41 KB
15.03 KB

Its the same lat/long
the view en marker .js in attachment

the files

sukr_s’s picture

I used your marker.js it works fine. but i cannot import your view since i don't have relevant content type. Thus I cannot help with that info. if you need support, you can contact me via my contact form.
----------------------------------------------
http://www.drupalfx.com

ikeigenwijs’s picture

Title: Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? almost » Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet?
Version: 7.x-1.x-dev » 6.x-1.1
Status: Needs review » Reviewed & tested by the community

I finally found my problem!!
In the general Gmap settings:
Marker action:
Do nothing
Open info window--> this has to be selected!
Open link -> not this

In the view:
Type ->gmap
Display a tooltip when hovering over markers (Must be cheked)
-> Tooltip field Node: Titel the others did not work

I dont dare tell you how much time i spend on this.
@sukr_s thx for the help, because of you i knew the java script was at least correct.
I m closing this, the fix works.

There is 1 improvement there should be done.
When there is a multiple marker, the hover tooltext is 1 titel instead of the count of the underlying markers.
It gives a wrong impression for the visitors.

ikeigenwijs’s picture

Title: Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? » Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? almost
Status: Needs review » Needs work
mcventur’s picture

Do you think that this solution can be adapted to improve the module, with the petition of the next issue? http://drupal.org/node/414968

grasmash’s picture

Status: Needs work » Reviewed & tested by the community

I think this should be committed.

@ikeigenwijs- while this may not be the behavior you'd prefer, it's far better than the default behavior currently offered by the module. I think we should start with this commit and work from there.

grasmash’s picture

Version: 6.x-1.1 » 7.x-1.x-dev

Moving to D7 because problem exists there as well. Patch is working in D7.

grasmash’s picture

Status: Reviewed & tested by the community » Needs review

Actually, I did find one issue with this-- there's not way to set the maximum number of marker results that can be displayed in an aggregated marker list. I'm going to implement that feature and submit a patch that will address this issue as well as the one mentioned here:
http://drupal.org/node/1208420

bramley’s picture

subscribing

orenbus’s picture

subscribing

ikeigenwijs’s picture

Title: Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? » Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? almost
Version: 6.x-1.1 » 7.x-1.x-dev
Frederic wbase’s picture

Hello

I've used the js file from 'ikeigenweis' in this thread. The grouping works, but when clicking on a marker with multiple nodes i get a bubble with the text 'There are multiple items at this location. Click an item title below for more details about the item.' But the generated links don't have content between the a tags.

If i edit the html true firebug i am able to click on the generated links and every thing works fine. Does anyone has an idea?

btw, many thanks to the community for the effort on this issue!

grts

fre

Frederic wbase’s picture

FileSize
9.55 KB

Hello

I've changed the js file a litte bit to work with drupal 7.12, latest views & latest gmap. It just shows the titles of the nodes with a link to the node.

grts

fre

Carlos Miranda Levy’s picture

subscribe

webservant316’s picture

subscribe - need to fix this asap also, but for gmap 6.x

webservant316’s picture

#11 works great for me on gmap 6.x-1.x-dev.

To get it to work...
1. Gmap default marker action needs to be pop-up window.
2. No marker manager is needed
3. View page style of Gmap must specify a 'Tool tip' which is used for the link list pop-up.

However...
4. One problem, the marker 'Tool tip' with multiple nodes picks one node at random for the hover text.
How can I change this hover text to be "Click for a list".

@ikeigenwijs also noted the same problem in #24 above.

Any solutions anyone? I am searching the code and the patch for a place to make this change.

Any help would be greatly appreciated.

Jeff

webservant316’s picture

FileSize
9.56 KB
42.39 KB

I've updated the patch in #11 in order to display the tooltips properly for list popups as well. If there is one location at a marker the tooltip specified in Views is used. If there is a list of locations the tooltip says 'Click for item list'. I also tuned up the list popup text a bit as well for a more general use case.

Changes were needed in marker.js and gmap.module.txt. It is truly a hack, so perhaps these features can be properly intregated into the module at some point. Also I do not have the tools to make a git patch, so perhaps someone get help there.

One last note. I also included another hack in gmap.module.txt to NOT display a popup at all when there is only one marker on the map. In my use case the popup was problematic for single marker location maps on a node, because the map was smaller, the popup didn't fit in the space and it wasn't needed anyway because the location vcard was already being displayed.

Here is the css I used to make things nice for me.

.gmap-popup {
	width: 300px ! important;
	margin: 0 0 10px 0 ! important;
	font-size: 90% ! important;
}

Hope that helps someone,

Jeff

DalSegno’s picture

Thanks for fixing the tooltips, Jeff. To make them translatable, I wrapped the text strings in gmap.module in t(' '). The text strings for the popups in the marker.js I translated in the code for now. I guess the strings could be moved to gmap.module (and then passed to marker.js as variables) to make them translatable as well?

david

webservant316’s picture

probably. my hope is that someone will take my work in #38 and clean it up into a proper patch that is eventually added to the module. the work I did really was a stretch for me, but it does work great.

flugga’s picture

subscribe

flugga’s picture

Agreed webservant316. I am looking forwarded to someone picking this up and properly integrating it!

yehmai’s picture

Version: 7.x-1.x-dev » 6.x-1.1

I have applied #38 on gmap "6.x-1.1" datestamp = "1278426618". The pop up windows is there. Just no node title were listed.

Then I went inside the marker.js to check showMultipleNodes = function(marker). It seems that the Drupal.settings.gmap['markerlist'][marker.latitude][marker.longitude].['opts']['title_list'] was "" (empty string).

However I did turn on the tool_tips and make sure the view has "Display a tooltip when hovering over markers" of Node:title. Any idea why this happened?

Thanks,
Yeh

webservant316’s picture

hmm, not sure. perhaps check the php code where [marker.latitude][marker.longitude].['opts']['title_list'] is assigned.

podarok’s picture

Version: 6.x-1.1 » 7.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

can You provide a patch against latest 7.x-2.x, 7.x-1.x ?

podarok’s picture

Status: Needs work » Needs review

test

Status: Needs review » Needs work

The last submitted patch, 1139088-muliple-node-markers-9-D6.patch, failed testing.

podarok’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Needs work » Needs review

proper version

podarok’s picture

Status: Needs review » Needs work

The last submitted patch, 1139088-muliple-node-markers-9-D6.patch, failed testing.

Jason Dean’s picture

These tweaks to marker.js are useful, but after playing around with it for a day I found OpenLayers to be a cleaner solution.

Using OpenLayers, I could apply grouping to my view (grouping rows with the same lat/long position). When using Gmap, grouping just seems to output a map for each group. OpenLayers has great tooltip and popup list functionality too (with scrolling for long lists etc).

I don't know how advanced OpenLayers is for D6, but definitely the way to go for D7.

designate’s picture

Version: 6.x-2.x-dev » 6.x-2.0-beta1

The marker patch was working great for version 6.x-1.1 but since the API change at Google no longer for 6.x.2.0-beta1. Anybody suffering the same and/or found a solutions already?

webservant316’s picture

not sure what problems you are seeing, but the marker patch still works for me. however, I did need to install this 'location' module patch - http://drupal.org/node/1944120

designate’s picture

Installed location module patch you mentioned on latest .dev version as well as marker.js from #38. When I overwrite the [original] marker.js with #38 nog markers are shown on map while - I made an attachment with nearest locations in text output - show some locations upon querry. While using original marker.js which came with module markers are also shown on the map without showing multiple nodes [i.e. 2] on same lat/lon.

webservant316’s picture

Here are all the patched versions of the files I am currently using for my mapping efforts.

location 6.x-3.2
google.inc
gmap 6.x-1.1
gmap.module.txt
gmap.taxonomy.module
marker.hs

These patched files enable me to
1. Display the tooltips properly for list popups.
2. Don't display a popup at all when there is only one marker on the map.

I also use this CSS

.gmap-popup {
width: 300px ! important;
margin: 0 0 10px 0 ! important;
font-size: 90% ! important;
}

And at https://code.google.com/apis/console I have turned on both Google Maps API v2 and Google Maps API v3.

podarok’s picture

http://drupal.org/patch

This is not patches

webservant316’s picture

Sorry, I don't have the tools to make patches. Maybe else someone can help.

designate’s picture

@webservant316, thanks for the files but I'm still not getting markers on the map with markers.js patched.

webservant316’s picture

Are you creating a view with style type 'gmap'? Is it configured properly? You will need to add the field type node:marker. You also need to create a relationship with the Location table and add that field as well. My code also assume a few additional CCK fields for my use case only. There are also tons of settings for the location, gmap, and gmap_location module. Too much to get into here. Sounds like something is not configured properly. Also check your php error log to see if that gives you a clue.

keraweb’s picture

Version: 6.x-2.0-beta1 » 7.x-2.7
Priority: Normal » Major

Is there a version for the GM API v3 aswell?? I really need this functionality!

keraweb’s picture

FileSize
9.98 KB

I started a API v3 version myself since i'm kinda in a hurry.

I will upload a version with this post where I've tried to implement these functions. It doesn't work completely.
I can't figure out how I can get the link to open the detailed popup from the combined one.

Maybe someone else can finish this.

I found a solution for what I needed, In my own version (not the one I upload here) I've created a custom function where the popup of a combined marker directly includes the complete text of all the markers it combined.
If anyone is interested in that function, please let me know.

drupalfmm’s picture

Component: Code » Meta issues
Category: feature » support
Priority: Major » Minor

I use 'GMaps Utility Library MarkerClusterer'.
"MarkerManager improved is the open source version of GMarkerManager. To use, you must download it from here and place it in the thirdparty folder."
Menu: admin / config / services / gmap

nvl.sateesh’s picture

hi,
thanks for the v3 marker.js. can you please provide the function you used to get the data.

when i use the marker3, i get the text that says there are multiple listings, but it does not show any items below.

also, when i use this with block view it seems to ignore the contextual filters and shows all the locations

thanks.

keraweb’s picture

FileSize
14.81 KB

Sorry for my extremely late responce.
I've uploaded the complete marker.js that I use now. I've added some custom functions to the script that do what I need them to do.

For a working example (it's in dutch): http://www.druyoga.nl/dru-yoga/vind-een-dru-yoga-docent

johanhaest’s picture

I just applied the marker js, and it works like a charm for me. Thanks!

Zsanna’s picture

It says "undefined". How do I set them to show node titles?

devad’s picture

I have used "GMap RMT for markers" option to display data from multiple nodes that have the same lat/long coordinates in one info window.

GMap RMT for markers option is nicely described here: #2108919: RMT option

Once, you have the views power in your hand to create info window... it's easy.

Kniekel’s picture

Thank you Devad for this hint.

How do you "transport" the info from the map to the bubbles?

Until now, I used "nid" as RMT field. This works really fine, but then, I only have ONE node in the bubble. I can't find the trick to get several nodes in one bubble.

Configuring it with Views will be easy then, of course. :-)

devad’s picture

You are welcome Kniekel

I had a usecase where I had needed to display multiple hotel offers in one bubble.

I got several nodes into one bubble using views relationships. It was easy for me since my offers had "Hotel" (node) entityreference field.

Working example: http://relaxino.com/en/offers

If your nodes with same location are not "grouped" by some kind of reference field but locations are "hardcoded" directly into nodes with same location... that's a different usecase from mine.

SeanA’s picture

Title: Displaying multiple markers that have the same lat/long coordinates in GMap Views -- any easy solution to this yet? almost » Displaying multiple markers that have the same lat/long coordinates in GMap Views
Version: 7.x-2.7 » 7.x-2.x-dev
Component: Meta issues » Code
Category: Support request » Feature request
Priority: Minor » Normal
Related issues: +#284481: GMap Views - show distinct markers or links for places with same lat/long
cardamomclouds’s picture

6 year old thread. I hope i can help someone in the future! or perhaps turn my code into a patch (i don't yet know how)
This is the portion i rewrote into gmap.module:

if (isset($map['markers'])) {
    foreach ($map['markers'] as $i => $marker) {
      $new_text = $map['markers'][$i]['text'];
      foreach ($map['markers'] as $i2 => $marker2) {
          if($marker  !== $marker2 &&
          $marker['longitude'] == $marker2['longitude'] &&
          $marker['latitude'] == $marker2['latitude'] &&
          (stripos($map['markers'][$i2]['text'], '<br>') === false)){
          $new_text .= '<br>' . $map['markers'][$i2]['text'];
        }
      }
      foreach ($map['markers'] as $i3 => $marker3) {
          if(
          $marker['longitude'] == $marker3['longitude'] &&
          $marker['latitude'] == $marker3['latitude']){
          $map['markers'][$i3]['text'] = $new_text;
        }
      }
    }
    foreach ($map['markers'] as $i => $marker) {
      if (isset($marker['text'])) {
        $map['markers'][$i]['text'] = '<div class="gmap-popup">' . $marker['text'] . '</div>';
      }
    }
  }

1.The first loop is part of the original construction.
2. I then add the $new_text variable and set it to the first marker's text.
3.Then I compare all other markers that have the same latitude and longitude and do not contain a line break(see 4)
4. I concatenate $new_text with a line break and the matching marker's text.
5. I then loop back over the whole stack so that all markers with the same coordinates will have ALL the values, equal to a
$new_text
6. The last loop is part of the original construction that adds a div for the pop up bubble text.

Three 2 extra loops seemed unnecessary, but it was the only way I could prevent duplicate texts.
A note on step 3: Since Gmap is limited to one field per bubble text, I didn't think using a line break would be a bad way to differentiate between which $marker['text] or $marker2['text] had been looped over or not. I suppose you could run stripos to see whether or not the first iteration contains the second within it, but this wasn't working for me.
Hope this helps someone!

charlysole’s picture

Hi cardamomclouds
I have tested your code, and it works, but showing duplicates...
3 times for each result.
Any clues?
Thanks!

Saratt’s picture

Hi charlysole,

Were you able to fix the duplicates issue?

Thank you.

fillmorejd’s picture

Here is updated code that will not have the duplicates.

 if (isset($map['markers'])) {
    $newMarkers = array();
    foreach ($map['markers'] as $i => $marker) {
        if (array_key_exists($marker['longitude'] . ':' . $marker['latitude'], $newMarkers)) {
          $newMarkers[$marker['longitude'] . ':' . $marker['latitude']]['text'] .= '<br/>' .$marker['text'];
        } else {
          $newMarkers[$marker['longitude'] . ':' . $marker['latitude']] = $marker;
        }
    }
    $map['markers'] = array_values($newMarkers);

    foreach ($map['markers'] as $i => $marker) {
      if (isset($marker['text'])) {
        $map['markers'][$i]['text'] = '<div class="gmap-popup">' . $marker['text'] . '</div>';
      }
    }
  }
Saratt’s picture

Thank you @fillmorejd. That worked for me.

charlysole’s picture

Thank you @fillmorejd. That worked for me too!
Should be included in dev

podarok’s picture

@fillmorejd could you please create a patch to be included to dev?

ikeigenwijs’s picture

Status: Needs work » Needs review
FileSize
1012 bytes

Rolled in to a patch. Needs to be tested.

I think i found the right section.
Next time mention the file and the line nr