1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
// JavaScript Document
var markers = [];
var urlMyXML="nancy.xml";
function loadMap()
{
//
var latlng = new google.maps.LatLng(48.65,6.157);
var option = {
zoom: 3,
center: latlng,
clickable: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"), option);
alert("Je vais lire XML");
readXML();
google.maps.event.addListenerOnce(map, 'bounds_changed', function()
{
// Creating a MarkerClusterer object and adding the markers array to it
var markerclusterer = new MarkerClusterer(map, markers);
});
}
// ...........................................................
function readXML()
{
jQuery.get(urlMyXML, {}, function(data) {
jQuery(data).find("point").each(function() {
var marker = jQuery(this);
latlng = new google.maps.LatLng(parseFloat(marker.attr("lat")),
parseFloat(marker.attr("lng")));
marker = new google.maps.Marker({
position: latlng,
icon: "Media/images/National.png"
});
google.maps.event.addListener(marker, 'mouseover', function() {
document.getElementById('txt_top').innerHTML = info;
});
//
google.maps.event.addListener(marker, 'mouseout', function() {
document.getElementById('txt_top').innerHTML = txtDefault;
});
markers.push(marker);
});
});
} |
Partager