Today, I finally got around to bringing the marker managers up to date. I also refactored the common behavior into its own file. Please test the next snapshot (Should appear in ~30 minutes from now) and report any issues. I want to make sure I didn't break anything else while doing this.

Comments

bdragon’s picture

Regarding Clusterer:

The README is currently out of date in regards to installing Clusterer. You want Clusterer2.js, and it goes in thirdparty/, NOT the root gmap folder.

I have a rewritten README in my working copy, but I'm not quite done with it yet.

bdragon’s picture

Whoops, forgot to post the dupe list.
http://drupal.org/node/127449
http://drupal.org/node/157330
http://drupal.org/node/154794
http://drupal.org/node/149275
http://drupal.org/node/134110
http://drupal.org/node/126845

Additionally, I fixed a bug earlier today regarding click not working after my changes. This is now fixed.

pillarsdotnet’s picture

Title: [META] [MASTER] Clusterer and GMarkerManager » Clusterer and GMarkerManager
Category: task » bug
Status: Postponed (maintainer needs more info) » Active

When enabling Clusterer2.js, clicking on a non-clustered pin has no effect. Still trying to figure out why...

pillarsdotnet’s picture

Status: Active » Needs review
StatusFileSize
new707 bytes

Fixed. Don't know why you create a copy of the marker object; you lost some of the properties in the copy. Commenting out that part yields the proper behavior (at least for me).

Here's the patch, both inline and attached.

--- orig/gmap/js/clusterer_marker.js    2007-09-18 16:43:25.000000000 -0400
+++ patched/gmap/js/clusterer_marker.js 2007-09-29 18:07:14.000000000 -0400
@@ -30,14 +30,14 @@
   });

   obj.bind('addmarker',function(marker) {
-    var m = new GMarker(new GLatLng(marker.latitude,marker.longitude),marker.opts);
+    // var m = new GMarker(new GLatLng(marker.latitude,marker.longitude),marker.opts);
     var t;
     if (marker.opts.title) {
       t = marker.opts.title;
       if (marker.link) t = t.link(marker.link);
     }
-    marker.marker = m;
-    obj.clusterer.AddMarker(m,t);
+    // marker.marker = m;
+    obj.clusterer.AddMarker(marker.marker,t);
   });

   obj.bind('delmarker',function(marker) {
mr.andrey’s picture

The patched fixed the single-node info window pop-up problem.

For some reason, double entries of nodes appear in the cluster popup. For example, if I click on a cluster that has two users, it gives me:
user1
user2
user3
user2
user2

And when there is a cluster present, but there's only one user, it somehow becomes a cluster and pops up:
user4
user4

Any ideas what might be causing this?

Thanks,
Andrey.

bdragon’s picture

Status: Needs review » Postponed (maintainer needs more info)

Blargh, I missed clusterer when moving the marker creation calls to a common file. Sorry about that.
@pillarsdotnet: Your patch is correct. Instead of commenting out the lines, I removed them. Thanks.

pillarsdotnet’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

So... is the patch going to be committed to dev or to HEAD ?

I'm already using it on http://www.kbsystem.com/dealers

bdragon’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Sorry, thought it was obvious that I had committed it.
http://drupal.org/cvs?commit=82829

mr.andrey’s picture

Is anyone else getting the problem where a single user is repeated twice, thus forming a cluster where it should be just a single marker? Am I missing something here?

Thanks,
A.

bdragon’s picture

Got a link to a test site?

mr.andrey’s picture

I just sent you the login info.

Thanks,
Andrey.

bdragon’s picture

Hmm, you do have multiple markers in the same spot.

Here's the markers that are being generated, in order.
andrey, fredburks, admin, admin, admin, bethreuter, admin, andrey, andrey, fredburks, admin, andrey, andrey, andrey, admin.

Could I see what your "location" table in the database contains at the moment?

mr.andrey’s picture

Sure.

INSERT INTO `location` (`eid`, `lid`, `type`, `name`, `street`, `additional`, `city`, `province`, `postal_code`, `country`, `latitude`, `longitude`, `source`, `is_primary`) VALUES
(2, 1, 'user', '', 'The Frog Palace', '', 'Berkeley', 'CA', '94703', 'us', 37.907637, -122.308731, 1, 0),
(4, 2, 'user', '', 'Some street.', '', 'Berkeley', 'CA', '94703', 'us', 37.874515, -122.279731, 1, 0),
(1, 11, 'user', '', '', '', '', '', '', 'us', 37.906605, -122.313323, 1, 0),
(1, 12, 'user', '', '', '', '', '', '', '', 37.906605, -122.313323, 1, 0),
(1, 13, 'user', '', '', '', '', '', '', '', 37.906605, -122.313323, 1, 0),
(6, 9, 'user', '', '1 Squirrel wy.', 'The Big Tree on the right', 'Squirlianto', 'CA', '90000', 'us', NULL, NULL, 0, 0),
(5, 3, 'user', '', '', '', 'Richmond', 'CA', '94804', 'us', 37.924281, -122.343831, 3, 0),
(1, 14, 'user', '', '', '', '', '', '', '', 37.906605, -122.313323, 1, 0),
(2, 4, 'user', '', '', '', '', '', '', 'us', 37.907637, -122.308731, 1, 0),
(2, 5, 'user', '', '', 'The Frog Palace', 'Berkeley', 'CA', '94703', 'us', 37.907637, -122.308731, 1, 0),
(4, 15, 'user', '', '', '', '', '', '', '', 37.874515, -122.279731, 1, 0),
(1, 10, 'user', '', 'Some street.', '', 'Berkeley', 'CA', '94703', 'us', 37.906605, -122.313323, 1, 0),
(2, 6, 'user', '', '', 'The Frog Palace', 'Berkeley', 'CA', '94703', 'us', 37.907637, -122.308731, 1, 0),
(2, 7, 'user', '', '', 'The Frog Palace', 'Berkeley', 'CA', '94703', 'us', 37.907637, -122.308731, 1, 0),
(2, 8, 'user', '', 'The Frog Palace', 'a', 'Berkeley', 'CA', '94703', 'us', 37.907637, -122.308731, 1, 0),
(1, 16, 'user', '', '', '', '', '', '', '', 37.906605, -122.313323, 1, 0),
(7, 17, 'user', '', '', '', '', '', '', '', NULL, NULL, 0, 0);

Looks like a load of extra stuff.

A.

bdragon’s picture

Yeah, it looks like the actual data contains duplicates. Not sure why though. Are you using the modified location and gmap_location modules from http://drupal.org/node/125001 and http://drupal.org/node/172841 ?

mikey081’s picture

Had a similar problem. I applied the patches you provided in the links. This solved the problem of my single user getting clustered. However, even though I have "Marker Action: Open Info Window" checked, no info window pops up with the Cluster Manager activated. Only with it turned off do the info windows pop up. Futhermore, I have numerous nodes located at the same address, yet the node location map shows no clusters.

mr.andrey’s picture

I just downloaded the Oct-2 release and applied the patches you mentioned. The patch to the location module worked fine, and the second, very long patched mostly worked except for gmap_marker.js:

=== js/gmap_marker.js.rej ===
***************
*** 66,71 ****
      if (marker.text) {
        marker.marker.openInfoWindowHtml(marker.text);
      }
      else if (marker.tabs) {
        var infoWinTabs = [];
        for (m in marker.tabs) {
--- 66,76 ----
      if (marker.text) {
        marker.marker.openInfoWindowHtml(marker.text);
      }
+     if (marker.rmt) {
+       $.get(obj.vars.rmtcallback + '/' + marker.rmt, {}, function(data){
+         marker.marker.openInfoWindowHtml(data);
+       });
+     }
      else if (marker.tabs) {
        var infoWinTabs = [];
        for (m in marker.tabs) {

update.php ran fine, and now looking at the map, the doubles disappeared.

Everything seems to be working fine, thanks!

One minor bug I'm noticing is that at the default zoom level of 8, there is one cluster and one user. When I zoom in one level, the single marker becomes a part of the cluster. Any ideas why this would happen? You can see it on my site.

Best,
Andrey.

mr.andrey’s picture

Oh, just noticed, the Location Map tab on the user profile has disappeared, so users can't set their location. Any ideas on what might have happened?

Thanks,
Andrey.

mr.andrey’s picture

Oops, forgot to copy the location directory to the live site from the dev server. Ignore my last comment. The Location Map now shows up under the address. -A

mr.andrey’s picture

Hi there,

There's a strange behavior that I'm seeing.

Starting at zoom level 0 (farthest out), I have a few people in the SF Bay Area. They are all in a cluster, which is good. Zoom level 1 is the same. On zoom level 2, one of them separated from the cluster and is showing up by itself, thus shadowing the cluster. On zoom level 3, it's back into the cluster. Zoom level 4, 5 and 6, there is only the cluster. On zoom level 7, a marker separated from the cluster, and it is not the same one as the one on level 2 (?). On zoom level 8, it's back in the cluster and the marker that separated on zoom level 2 is now broken away from the cluster. Zoom level 9 & 10 - everyone's back in the cluster. 11 - both of the markers that got broken away are now separate from the cluster. From this point on, the behavior is normal.

Any ideas? This seems totally random, though very consistent.

bdragon, if you want you can see this on my dev server.

Thanks,
Andrey.

bdragon’s picture

I'm seeing this too. My instinct is that it is actually a bug in Clusterer.

mr.andrey’s picture

I just sent an email to Acme Labs with login info so they can see it for themselves. I included this thread too.

Any other ideas?

Andrey.

bdragon’s picture

Title: Clusterer and GMarkerManager » Clusterer clustering oddities

More appropriate title

mikey081’s picture

StatusFileSize
new82.5 KB

Noticed you made a lot of awesome changes and updates to the GMap module this past day. Excellent work. The clusterer now works for me for the first time now! It works well for my node location map- I do notice the cluster and un-cluster issue at various zooms that mr.andrey noted. The bigger problem I'm having is that it still doesn't work well with my user map. I have a single user, yet a cluster is created for it. Also, when I click on the cluster, I get 10 replications in the info box, and the last line says there are 277 more! Pic attached to show you exactly what I mean...

Seems like a simple bug that is reading things weirdly from the database, or might be something else entirely. I'm not a programmer, so I can only tell you what I see in plain view...

Thanks for all the hard work!

Mikey

mr.andrey’s picture

Did you try this patch?
http://drupal.org/files/issues/gmap_location_rewrite.patch

And this one on Location?
http://drupal.org/files/issues/location-user-latlon.patch

I had the same issue with many usernames being generated for one person, thus creating a cluster, and the above two patches with the Oct-4 release fixed that.

And yes, thanks bdragon for all the wonderful work on this, Category, and other modules - it's really making a lot of things possible for many people, and it is very much appreciated! I'm looking forward to your new baby Geo.

Best,
Andrey.

mikey081’s picture

That did it- although my eyes are killing me after going in to the gmap location module modifications... Thank you for your help!

mr.andrey’s picture

You did it manually? ack! Just do this next time you upgrade gmap:

In shell:

wget http://drupal.org/files/issues/gmap_location_rewrite.patch
patch -p 0 <gmap_location_rewrite.patch

I tried to do it manually at first too, but it drove me nuts, and didn't work, as I definitely missed something, then I remembered patching linux kernel back in my sysadmin days, and dug up how to patch things automatically. You can do this with most patches, however, if you apply multiple short ones, sometimes it's still better to do it manually, as the changes might be conflicting.

Best,
Andrey.

P.S. I would really like to get the Clusterer fixed, as it's the only thing that doesn't work flawlessly. I didn't hear back from Acme Labs yet about their script.

mr.andrey’s picture

Another clustering issue, this one's very strange.

On Firefox everything works, but on IE, I'm getting a javascript error:

Line: 13
Char: 32
Error: Invalid argument.
Code: 0
URL: http://site.com/map/user

And though the cluster appears, I cannot click on it, whereas in Firefox, I can and it works fine.

Any ideas on this one?

Best,
Andrey.

mr.andrey’s picture

While using a debugger, this is the line that breaks the script:

function ga(a,b){var c=a.style;c[Tb]=Q(b.width);c[$c]=Q(b.height)}

And here it is in context:

function Sc(a){return a+"em"}
function O(a,b){rb(a);var c=a.style;c[Jc]=Q(b.x);c[bc]=Q(b.y)}
function Ee(a,b){a.style[Jc]=Q(b)}
function ga(a,b){var c=a.style;c[Tb]=Q(b.width);c[$c]=Q(b.height)}
function Mp(a){return new t(a.offsetWidth,a.offsetHeight)}
function Rb(a,b){a.style[Tb]=Q(b)}
function Yc(a,b){a.style[$c]=Q(b)}
bdragon’s picture

Looks like google maps compressed code. Reading that compressed code makes me feel that this is the code that sets up popup dimensions. Perhaps it's balking on displaying too much data?

mikey081’s picture

Second that- except I don't even get markers showing in the latest version of IE. For some reason, an older version of IE showed markers, but they were unclickable.

mr.andrey’s picture

I noticed that the old version of gmap that is on my dev server works fine, so I did a diff -qr and replaced the files one by one until the error was gone. The file that seemed to be making the difference was js/icon.js, and here is the difference between the old (working) and the new (broken) Oct-10 version:

icon.js.old icon.js.orig
--- icon.js.old 2007-10-12 07:52:41.000000000 -0700
+++ icon.js.orig        2007-10-12 07:51:10.000000000 -0700
@@ -3,7 +3,7 @@
  *
  * Required for markers to operate properly.
  */
-/* $Id: icon.js,v 1.1.2.7 2007/05/23 20:10:20 bdragon Exp $ */
+/* $Id: icon.js,v 1.1.2.8 2007/10/04 18:11:37 bdragon Exp $ */

 /**
  * Get the GIcon corresponding to a setname / sequence.
@@ -41,7 +41,7 @@ Drupal.gmap.getIcon = function(setname,
       var t = new GIcon();
       var p = Drupal.gmap.iconpath + q.path;
       t.image = p + q.sequence[i].f;
-      if ((typeof(q.shadow)=='string') && (q.shadow != '')) {
+      if ((typeof(q.shadow)!='string') && (q.shadow.f != '')) {
         t.shadow = p + q.shadow.f;
         t.shadowSize = new GSize(q.shadow.w, q.shadow.h);
       }

Changing the line back to the old version fixes the problem.

Any ideas on this?

Andrey

bdragon’s picture

Yeah, do you have any references to nonexistent files in your marker .ini files?

mr.andrey’s picture

Not any that I put in there - it all came with standard markers as unpacked from gmap module, and I didn't alter anything in the .ini files prior to this error.

Best,
Andrey.

bdragon’s picture

Status: Postponed (maintainer needs more info) » Fixed

Yeah, I had accidentally put shadow = '' in several .ini files. This was causing major weirdness in some browsers.

Should be working now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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