I am trying to create some markers with Google Maps from
XML file clicking in an image of gallery. My Javascript
code is simple , above:
function initialize()
{
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 8);
map.setUIToDefault();
var Icon = new GIcon();
Icon.image = "blue_large.png";
Icon.shadow = "shadow_large.png";
Icon.iconSize = new GSize(20, 34);
Icon.shadowSize = new GSize(37, 34);
Icon.iconAnchor = new GPoint(9, 34);
Icon.infoWindowAnchor = new GPoint(9, 2);
Icon.infoShadowAnchor = new GPoint(18, 25);
// A function to create the marker and set up the event window
function createMarker(point,html,Icon)
{
var marker = new GMarker(point,Icon);
GEvent.addListener(marker, "mouseover", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
GDownloadUrl("../../photos.xml", function(doc)
{
var xmlDoc = GXml.parse(doc);
var photos = xmlDoc.documentElement.getElementsByTagName
("photo");
for (var i = 0; i < photos.length; i++)
{
// obtain the attribues of each marker
var lat = parseFloat(photos[i].getAttribute("lat"));
var lng = parseFloat(photos[i].getAttribute("lng"));
var point = new GLatLng(lat,lng);
// create the marker+
var marker = createMarker(point,html,Icon);
map.addOverlay(marker);
}
});
}
Body section:
<img id="mainImage" onclick="initialize();" alt="main image" src=""/
></div>
XML file, looks these tags :
<photo
path = "athens_parthenon1.jpg"
width = "350"
height = "262"
thumbpath = "athens_parthenon1.jpg"
thumbwidth = "75"
thumbheight = "56"
lat ="37.972517"
lng ="23.723087" >
</photo>
However I need to show in the map only the marker.
It loads Google Maps however not display any marker on
click image , as you can see here :
http://webmaps.net46.net/AJAX/Spry/demos/gallery/index2.html
My intention is show each photo in the front-end and your
geolocalization in the Google maps.
I hope somebody say me where is the error.
thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---