Clustered item titles don't appear in pop-up on GMap style view

BWPanda - November 3, 2008 - 00:50
Project:GMap Module
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Just wondering how the cluster feature is supposed to work...

I've enabled it for my site and tested it with two nodes on the map, and it seems to work (a larger cluster marker appears instead), but when I click on it, it just opens an info window with two marker images, no text and you can't click on them...

What I'd prefer to happen is what happens when you double click on the cluster marker - the map zooms in to show each of the node markers individually.
Is there a way to make this happen by just single clicking on a cluster?

#1

BWPanda - November 10, 2008 - 05:13
Title:Cluster feature» How's the Cluster feature work?

Anyone able to help me understand this?

#2

BWPanda - November 16, 2008 - 22:58

Nobody...?

#3

sjf - November 18, 2008 - 13:23
Title:How's the Cluster feature work?» Empty info pop-up when using clusterer
Version:6.x-1.0-rc2» 6.x-1.x-dev
Category:support request» bug report

I've changed the title and marked this as a bug report, though the zoom-on-click is probably also a feature request.

For the bug, here is a snapshot of the same thing on my site. Drupal 6.6, latest devs of location and gmap as of 18 Nov 2008. Using clusterer2.js with the private file system.

AttachmentSize
empty_clusterer.jpg 42.36 KB

#4

anotheraviator - November 28, 2008 - 13:40

I have this very same issue on 6.6 -- but only when displaying from a gmap view. If I look at map/node it works fine.

#5

BWPanda - December 2, 2008 - 01:40
Status:active» needs review

I found this post which said that the problem was with the Clusterer.js file, and had some code to fix the issue. I added the code to my Clusterer.js file (after customising it somewhat) and confirmed that it works. I made a patch for anyone else interested in using this code.

AttachmentSize
GMap-329281-5.patch 1.9 KB

#6

kkrgopalan - January 14, 2009 - 01:07

subscribe

#7

anotheraviator - January 16, 2009 - 21:14

The code provided in the above post worked well for me. Added bonus is that I prefer zooming to the area vs. a list.

#8

xolotl - January 17, 2009 - 08:14

For me, applying this patch enables the "click zoom" functionality...ie, when you click on a cluster, you zoom in to it. But when you zoom in, markers are still clustered and only the top marker is clickable for an info window. That info window does now have the right information populated in it however.

Running Drupal 6.9/gmap 6.x.1.0.

#9

j0rd - February 2, 2009 - 12:38

I have the same problem using the latest stable code. Drupal 6.9 and Gmaps 6--1-0.

I'll apply the patch here and now everything is working fine.

For those who are interested, the patch changes this.

Before Patch:
when you click on a cluster, you get that lame popup. You can't actually click on the marker to zoom closer.

After Patch:
when you click on a cluster, you are zoomed into that cluster. Much better.

#10

xolotl - February 2, 2009 - 22:45

To clarify my use case: I have multiple markers at the exact same lat/long, so zooming in doesn't by itself solve the issue. If the markers are on the same point, I really need a popup that is correctly populated with all the markers stacked on that point.

#11

akahn - February 9, 2009 - 19:23

I'd like to bump this, because I also have the issue nato identifies in #10. Does anyone have a way of using the default clusterer behavior (popup), but filling that popup with more useful information (such as links to each node in the list, or a link that brings up the 'info window' within the map.

Any ideas?

#12

jcamfield - February 26, 2009 - 21:44

I also am experiencing this problem; I have multiple events at one location, so zooming (while a great feature) doesn't solve this particular problem of getting a list of markers (with no node.titles, links, etc)

#13

jcamfield - February 27, 2009 - 18:10

Here's a live example (until I change the settings at least)
http://test.globalyouthserviceday.org/plainmap/2009/us/PA/Newcastle

Note the clusters - keep clicking on them - there are multiple events happening at those locations, so once you get down to the specific location, you're stuck. This is only slightly better than showing you a list of drupal-markers without names/fields/links

#14

erikhopp - March 13, 2009 - 19:15

I'm also having this problem. I had submitted another bug (#400616: clustered item titles do not show up using Jef Poskanzer's Clusterer) but realized this was the same one as this after I found this one. I can test solutions if that is enticing! I am also in the position where I have several nodes pointing to the exact same address lat/long and therefore need clustering to show a stacked list of node titles (or potentially other customizable fields / a template for display). Let me know if I can help! Erik.

#15

sagannotcarl - March 14, 2009 - 22:57
Status:needs review» active

I'm changing the status back to active because while the patch is super useful it doesn't address the issue of "Empty info pop-up when using clusterer".

This may have been added since this patch was created but the functionality you get with this patch is already available using the administrative options in Gmap (see screenshot). You can choose whether you want the pop-up mode to be original or zoom.

Does anyone have an idea where to look for fixing the issue of the empty pop-up?

AttachmentSize
Clusterer_admin.png 22.9 KB

#16

BWPanda - March 15, 2009 - 22:54

Yes, that functionality was only recently added to GMap. I found quite a few problems I was having were fixed by updating to the latest version.

#17

sagannotcarl - March 17, 2009 - 16:03
Component:Miscellaneous» Code

In looking through some of the javascript for where the title is set, I found this on line 36 of clusterer_marker.js:

  obj.bind('addmarker', function (marker) {
    var t = '';
    if (marker.opts.title) {
      t = marker.opts.title;
      if (marker.link) {
        t = '<a href="' + marker.link + '">' + t + '</a>';
      }
    }
    obj.clusterer.AddMarker(marker.marker, t);
  });

It looks like there is no marker.opts.title so that if statement is failing. I can't seem to find the title anywhere else in that marker object either but I may just not know where to look.

Maybe something changed with the marker object? Does anyone know where the title lives in that object. If you manually set the t variable there (or add an else to the end of that if) the titles work fine in the clusters.

#18

j0rd - March 23, 2009 - 17:03

The new clusterer (Martin Pearman's ClusterMarker) that's provided in the new version works wonderfully. Thank you guys for all your hard work. GMaps + Location are my two new favourite modules.

#19

bneel - March 29, 2009 - 20:22
Priority:normal» critical

I found a solution for the D5 within the Clusterer2.js. See my website : http://www.lefermenteurabioreaction.com/map/carte-biotech-plus
Now I want to upgrade my site to D6 and my patch doesn't works. (see the attached file)
The patch previously added in this issue or the Martin Pearman's ClusterMarker are not suitable for nodes with the same lat and long.
I change the priority to critical because the Jef Poskanzer clusterer is completely useless. I tried to do something but with no success.
Ben

AttachmentSize
Clusterer2.js.txt 12.51 KB

#20

tonycpsu - April 13, 2009 - 21:25

Subscribing.

#21

tislammac - May 5, 2009 - 20:10

I had an issue with Clusterer2.js: If two+ nodes were located in the same exact place, I needed the popup with node lists to show. However, only the small red icons were showing up in the popup, not the titles.

Here's the change that shows the titles (changed the clusterer_marker.js file in the gmap module, Drupal 6):

obj.bind('addmarker', function (marker) {
var t = 'Product!';

/*
if (marker.opts.title) {
t = marker.opts.title;
if (marker.link) {
t = '' + t + '';
}
}
*/
if (marker.text) {
t = marker.text;
if (marker.link) {
t = '' + t + '';
}
}
obj.clusterer.AddMarker(marker.marker, t);
});

marker.opts.title was null, hence i am now using marker.text

#22

bneel - May 5, 2009 - 21:01
Status:active» fixed

You are the king

#23

bneel - May 5, 2009 - 21:02
Status:fixed» patch (to be ported)

bdragon, are you ok with this ?

#24

amedee - August 13, 2009 - 15:40

In reply to #21:
The original code in my clusterer_marker.js is:

  obj.bind('addmarker', function (marker) {
    var t = '';
    if (marker.opts.title) {
      t = marker.opts.title;
      if (marker.link) {
        t = '<a href="' + marker.link + '">' + t + '</a>';
      }
    }
    obj.clusterer.AddMarker(marker.marker, t);
  });

Changed to:
  obj.bind('addmarker', function (marker) {
    var t = '';
    /*
    if (marker.opts.title) {
      t = marker.opts.title;
      if (marker.link) {
        t = '<a href="' + marker.link + '">' + t + '</a>';
      }
    }
    */
    if (marker.text) {
      t = marker.text;
      if (marker.link) {
        t = '<a href="' + marker.link + '">' + t + '</a>';
      }
    }
    obj.clusterer.AddMarker(marker.marker, t);
  });

This works excellent for me. The only remaining problem is that there is no clustering with the closest zoom; you get the default popup with only one node. This is a (minor) issue with multiple nodes on an identical location.
Working example: http://foutparkeerders.be/kaart

#25

BWPanda - October 21, 2009 - 13:36
Status:patch (to be ported)» fixed

Marking this issue as fixed since the original problem was the empty popup windows which, if I'm not mistaken, have been fixed in recent versions of the module. Other problems such as multiple markers at the same lat/long should be addressed separately, such as here: #530328: Multiple markers with the latitude/longitude on a single GMap

#26

marcp - October 23, 2009 - 23:15
Priority:critical» normal
Status:fixed» active

This is still an issue.

The solution in #24 works, as long as you want the full text that would normally appear in the node's popup window to also appear in the list of clustered items.

gmap_plugin_style_gmap::render(), where the $markers array is built, should have a way of passing in opts -- something like:

           'opts' => array('title' => $label),

I guess the question is, what should be passed in as the title? I'd like it to be the node's title, but I haven't dug in enough to figure out if gmap_plugin_style_gmap has that information. The line of code above sends $label out as the title, which, in my case, seems to be a number, and I haven't figured out yet where that number comes from...

#27

marcp - October 23, 2009 - 23:31

For a node-based view where the node title is included as one of the fields, adding this line to gmap_plugin_style_gmap::render(), where the $markers array is built does what I'd expect it to do:

            'opts' => array('title' => l($row->node_title, 'node/' . $row->nid)),

Now in the cluster popup, the listed items are node titles that link to the node.

This doesn't work, though, in the generic case where you don't want the text in the clustered popup to be the node title linked to its node. There should be some way of configuring what the text is for an item when it's displayed as one item in a clustered popup.

I haven't tested a map with view of users, but in that case, you'd probably just want the user's name linked to its profile (or maybe not -- maybe you just want the user's First and Last Name).

#28

marcp - October 25, 2009 - 17:19
Title:Empty info pop-up when using clusterer» Empty clustered item titles in pop-up on GMap style view

Changed the title to reflect the true issue here. It's only a problem on GMap views.

Comment #4 hits the reason why this issue may not be bothering too many people. The map/node view works fine -- node titles appear in the clustered popup courtesy of:

      $newmarker['opts']['title'] = check_plain($row->name);

in gmap_location.module's gmap_location_user_page() function.

There's no corresponding code in gmap_plugin_style_gmap::render() to set the marker's title. The partial fix in #27 makes it work for node-based GMap views.

Are there any maintainers interested in getting this fixed? If so, please ping this issue -- I'd be glad to supply some patches if you'll chime in with some guidance on how you think this should best be addressed.

#29

marcp - October 25, 2009 - 17:20
Title:Empty clustered item titles in pop-up on GMap style view» Clustered item titles don't appear in pop-up on GMap style view
Status:active» needs review

Setting to "needs review" in order to get some feedback on how to proceed with a fix for this issue.

#30

marcp - October 25, 2009 - 21:55

One way to go with this would be to add another option in gmap_plugin_style_gmap.inc that lets the view builder pick the field that will be used for the clustered item title. I've got part of this coded up -- the attached screen shot shows what it will look like.

AttachmentSize
clusterfield.png 11.07 KB

#31

ChrisRut - October 28, 2009 - 21:44

:subscribe:

#32

yann_riviere - November 18, 2009 - 23:13

Hello Marcp,

Don't now why but it seems to nt work for me.....

here is the code :

$markers[] = array(
'latitude' => $lat,
'longitude' => $lon,
'markername' => $markername,
'offset' => $offsets[$markername],
'text' => $this->row_plugin->render($row),
'opts' => array('title' => l($row->node_title, 'node/' . $row->nid)),
);

Is there an error in my copy/paste ?

Thanks a lot !

#33

marcp - November 19, 2009 - 00:25

@yann_riviere - I'm not sure why that wouldn't be working for you if you put that line in gmap_plugin_style_gmap::render(). Your view also needs to be node-based, but I'm sure you've got that under control.

Maybe try putting some debugging info in gmap_plugin_style_gmap::render() to see if it's even getting called in your case.

#34

srobert72 - November 19, 2009 - 18:29

I found also that this issue with Cluster is same as missing Tooltip in GMap Views.
I wrote a patch to set Tooltip as you do, but it offers possibility to choose what field to use as Tooltip info.
See #9 in #364413: GMap style views: missing tooltip

#35

yann_riviere - November 19, 2009 - 22:36

@marcp - I'm not dealing with views. I'm am accessing the Map via the URL : map/node.

I have forgotten to check the "Open Link" in the Marker action of the Gmap Location settings !

Now, the Windows info is displaying node titles with an Hypertext link to the node.

Thanks !

#36

marcp - November 19, 2009 - 23:04

@yann_riviere - Right -- this isn't a problem with map/node -- only when going thru Views.

Still a valid issue with Views, though.

#37

danieldd - November 23, 2009 - 22:52

marcp - thanks very much. #27 did produce the missing tooltip in Gmap Views for me.

One quick question - this produces a node title that should link to its node.
Although in my case the tooltip is not rendering the html link - ie it is displaying <a href="/nodepath/node-title">node-title</a> instead of rendering the link. Any idea how I fix? Thanks

#38

marcp - November 24, 2009 - 22:28

@danieldd - sounds kind of like a filter issue. Not sure what's going on there.

#39

GiorgosK - December 3, 2009 - 22:44
 
 

Drupal is a registered trademark of Dries Buytaert.