Hi.
I have been working on a dynamic map for a game lately and I am trying
to add markers from database entries.
I have mad the database and added a few entries into it, I have also
made a .php file that creates a xml file that the Google Maps API
should be able to collect information from that to add markers onto my
map.
The map is located here:
http://www.undergroundrp.com/dev3/map.html
The .php file that creates the .xml file is here:
http://www.undergroundrp.com/dev3/phpsqlajax_genxml.php
The code I am currently using to attempt to collect the xml
information and put it onto the map:
<!--Add Markers From Database Start-->
downloadUrl("phpsqlajax_genxml.php", function(data) {
var xml = parseXml(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var description = markers[i].getAttribute("description");
var image = markers[i].getAttribute("icon");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "<b>" + name + "</b> <br/>" + description;
var image = '
http://google-maps-icons.googlecode.com/files/'+icon;
var marker = new google.maps.Marker({
map: map,
position: point,
icon: image,
shadow: '
http://google-maps-icons.googlecode.com/files/
shadow.png'
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
<!--Add Markers From Database End-->
But this "destroys" my map, and I have no idea how to do this, I have
no problem with php and sql but when it comes to this Java and Google
Maps API I am really a noob ^^
If anyone got any idea on how I would be able to load this I would be
very greatfull.