Using the Gmap API, markers are not showing up on my map. I suspect I'm doing something wrong but I don't know what. Any help would be most appreciated.

Here is the php code where I create the markers:

$mymarkers=array(array('markername'=>'blue',
                       'label' => 'Terminal bus stop',
                       'latitude' =>'49.19236205396474',
                       'longitude'=>'-123.1790542602539'));
      $mymap=array('id' => 'mymap',
             'latitude' => '49.19258642226091',
             'longitude'=>' -123.17647933959961',
             'zoom' => 10,
             'width' => '100%',
             'height' => '400px',
             'type' => 'Satellite',
             'markers' => $mymarkers);

The markers seem to show up in the html file:

Drupal.extend({ settings: { "gmap": { "map": { "width": "100%", "height": "400px", "zoom": 10, "controltype": "Small", "align": "None", "maptype": "Map", "line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior": { "locpick": false, "nodrag": 0, "nokeyboard": 1, "nomousezoom": 0, "autozoom": 0, "dynmarkers": 1, "overview": 0, "notype": 0, "collapsehack": 0, "scale": 0, "fatmarkers": false }, "markermode": "1", "id": "map", "latitude": "49.19258642226091", "longitude": " -123.17647933959961", "type": "Satellite", "markers": [ { "markername": "blue", "label": "Terminal bus stop", "latitude": "49.19236205396474", "longitude": "-123.1790542602539" } ], "querypath": "http://www.xxx.com/map/query" } } } });

But they don't get displayed on the map.

I thought that perhaps the marker images weren't being found, so I put a copy of the folder with my custom module. But no luck.

Any suggestions of what may be wrong?
Should I be specifying the location of the folder somewhere?

Thanks very much.

Comments

kobnim’s picture

Following up from my question above ...
Given that the markers seemed to make it into Drupal.settings, I wondered if for some reason they were not getting into Drupal.gmap, so I tried dumping some variables. However, I'm still left scratching my head.

Here are the contents of Drupal.gmap.getMap('mymap').vars.markers[0]:

'markername' => "blue" 'label' => "Terminal bus stop" 'latitude' => "49.19236205396474" 'longitude' => "-123.1790542602539"

When I try to open an InfoWindow, as in the code below, the javascript stops executing.

Drupal.gmap.getMap('mymap').vars.markers[0].marker.openInfoWindow("hello");

My guess is that Drupal.gmap.getMap('mymap').vars.markers[0].marker does not exist, for some reason.

If anyone has any suggestions of what might be wrong, or how I might continue to diagnose the problem, I would be grateful.

kobnim’s picture

Again following up from the original question ...
I am now even more confused than ever, and any enlightenment would be appreciated.

Here's what I did:
I grabbed the html from a map on my site that correctly displays markers (the User Locations map).
I was hoping I would see some difference in Drupal.settings between this "good" html file and mine, that would explain why markers were not showing up on my map. But I did not see any such difference.
I then uploaded this "good" html file to the gmap directory on the server.
And lo and behold, the 'good' html file no longer displayed markers on the map.

So I am confused.

Could anyone enlighten me on what may be going on? If I understood why markers don't show up on the 'good' html file when it is copied back up to the server, then perhaps I'll understand why they're not showing up on my map.

Thanks for any help you might be able to offer.

rolandos’s picture

the same in my page. The markers seem to show up in the html file, but they don't displayed on the map. but before they showed up, since 1 -2 days ? no more......
don't know what to do, any solutions?

r.

jsm174’s picture

Did anyone figure this out? I'm having the same issue.

Firebug is showing two errors:

(markers line 1)

invalid label
   iconSetup(undefined)
   success()
   e()
   [Break on this error] { "path": "/drupal/sites/all/modules/gmap/markers", "markers": { "/big/": { "f":...
(icon.js line 73)

   json has no properties
   [Break on this error] var rootpath = json.path;

My jQuery is updated to 1.2.2.

Thanks,
-- Jason

kobnim’s picture

Jason,
Unfortunately no, I have not figured this one out. Anyone else have a suggestion?
-Mindy

nicholasthompson’s picture

Juts thinking out loud here really...

  • There is a space between the quote and the -123 of longitude...
  • You are defining your Lat and Long as strings and not floats...

Any of that help?

jsm174’s picture

Just wanted to give a quick status update.

For my case, it looks like it was a jQuery issue after all. There is a bug in 1.2.2 that affects JSON calls.

It looks like it will be fixed in the upcoming 1.2.3:

http://dev.jquery.com/ticket/2174
http://dev.jquery.com/changeset/4476

Anyway, I downgraded to 1.2.1 and the markers are now working fine.

-- Jason

rolandos’s picture

Now i get a reason why my markers not displayed.
look at this:

http://groups.google.de/group/Google-Maps-API/browse_thread/thread/83b8e...

I have the prototype.js in my lightbox. If deactivate the lightbox markers will display again.
Is there a workaround?

r.

edit:
The latest lightbox modul 5.x-2.3 doesn't work with the prototype librairie. Markers will display.

jenlampton’s picture

Version: 5.x-1.x-dev » 5.x-1.0-alpha1

I tried the upgrade to jQuery 1.2.6 and a downgrade to 1.2.1 neither made my markers show. I also posted on this duplicate thread

bdragon’s picture

Version: 5.x-1.0-alpha1 » 5.x-1.x-dev
Status: Active » Postponed (maintainer needs more info)

Try again with the next snapshot. I added some code to validate the latitude / longitude.
You may also be experiencing the "shadow bug". http://drupal.org/node/191019

bdragon’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)