views:

37

answers:

1

I have a url that returns XML coordinates in the below format. I want to put a Google map on my page and feed it these push pin coordinates. Is there a nice and quick way to do this via Javascript or jQuery?

<messageList>
<totalCount>1</totalCount>
−
<message>
<esn>0-7396996</esn>
<esnName>JOHN</esnName>
<messageType>TEST</messageType>
<messageDetail> ALL IS WELL AT CURRENT LOCATION.</messageDetail>
<timestamp>2010-05-24T00:39:12.000Z</timestamp>
<timeInGMTSecond>1274661552</timeInGMTSecond>
<latitude>25.19483</latitude>
<longitude>65.7162</longitude>
</message>
</messageList>
A: 

I would suggest transforming your xml into KML which google maps can handle very happily using an inbuild method called GGeoXml.

KML is a standard geo-coding data format which is used be a number of different mapping solutions.

or you can parse your xml and create a marker like this:

var point= new GLatLng(25.19483, 65.7162);
var marker = new GMarker(point);
map.addOverlay(marker);
skyfoot
It should be noted that the above solution is for the V2 API. The solution changes dramatically for V3.
thewinchester