I am using Google maps and an xml file to create my maps.
I read the xml file to get the info for the map but if my xml file has loads of records, it displays them all on the map.
What I want to be able to do is select a specific record of the xml file.
How would i select a record with a given id i choose?
<?xml version=“1.0” encoding=“UTF-8” ?>
<markers>
<marker id="1" startaddress="Oxford Folk Festival" starttown="Oxford" startpostcode="OX1 9BE" startlat="51.729639" startlng="-1.28049" starttype="Start"></marker>
</markers>
GDownloadUrl("results.xml", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
//Set up the start markers
var srtaddress = markers[i].getAttribute("startaddress");
var srttown = markers[i].getAttribute("starttown");
var srtpostcode = markers[i].getAttribute("startpostcode");
var srttype = markers[i].getAttribute("starttype");
var srtpoint = new GLatLng(parseFloat(markers[i].getAttribute("startlat")),
parseFloat(markers[i].getAttribute("startlng")));
var srtmarker = createStartMarker(srtpoint, srtaddress, srttown, srtpostcode, srttype);
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(srtpoint,13);
map.addOverlay(srtmarker);
}
});