Skip to content Skip to sidebar Skip to footer

Passing Xml Markers To Google Map

I've been creating a V3 Google map based on this example from Mike Williams http://www.geocodezip.com/v3_MW_example_linktomap.html I've run into a bit of a problem though. If I hav

Solution 1:

As I tried to say. You have a global:

var id;

And the only place it seems to be set (or not) is from the query string. Yet when you loop thru your xml input you call createMarker() which uses that global id.

functioncreateMarker(point, icon, label, html) {
        var contentString = html;
        var marker = new google.maps.Marker({
            position: point,
            map: map,
            title: label,
            icon: icon,
            zIndex: Math.round(point.lat() * -100000) << 5
        });
        marker.id = id;


 ....

Thus each marker gets the same id. If I was you I'd add the "id" to the xml file as another attribute and set it from there and use the query string id to only execute your selection logic.

Post a Comment for "Passing Xml Markers To Google Map"