OK so, found the problem,

      place = response.Placemark[0];
>                         point = new GLatLng(place.Point.coordinates[1],
>                           place.Point.coordinates[0]);
>                         marker = new GMarker(point);

needs to be declared as

var place = response.Placemark[0];
var point = new
GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
var marker = new GMarker(point);

because there are more than one, so it will always reference the last acted
on object if a new instance isn't created but is now plotting to the correct
location.



On Thu, Oct 15, 2009 at 9:03 AM, Grok Lobster <[email protected]>wrote:

>
> Take a look at Mike's tutorial
> http://econym.org.uk/gmap/basic12.htm
>
> On Oct 14, 12:35 pm, Nathan Veysey <[email protected]> wrote:
> > Im having trouble referencing the Marker information for adding custom
> > info window popups,
> >
> > problem being that the GetLocations function completes after my
> > Markers are drawn,
> >
> > I can make the custom popup window show, roughly based on this
> examplehttp://marcgrabanski.com/article/jquery-google-maps-tutorial-basics
> ,
> >
> > but only occurs for the last drawn element, is there a method I can
> > use that will allow me to run the marker creation script after the
> > markers are drawn, with a index of the array would also be nice?
> > Finding it hard to locate examples on this.
> >
> >         function parseJson(doc) {
> >                         var jsonData = eval("(" + doc + ")");
> >                         for (var i = 0; i < jsonData.markers.length; i++)
> {
> >                                 var mData = jsonData.markers[i];
> >                                 gmapdata.push(mData);
> >
> >                                 geocoder.getLocations(mData.fulladdress,
> createMarker);
> >                         }               }
> >
> >                 function createMarker(response) {
> >                         place = response.Placemark[0];
> >                         point = new GLatLng(place.Point.coordinates[1],
> >                           place.Point.coordinates[0]);
> >                         marker = new GMarker(point);
> >                         gmarkers.push(marker);
> >                         GEvent.addListener(marker, "click", function() {
> >
> >                         Infowin(marker.getPoint());
> >                         });
> >
> >                         gmap.addOverlay(marker);
> >                 }
> >
> >         var geocoder = new GClientGeocoder();
> >                 GDownloadUrl("Json.ashx", function(data, responseCode) {
> >                         parseJson(data);
> >                 });
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to