2
I’m trying to use this code to read the coordinates data xml
instead of the statically inserted data in the code but it doesn’t work when done this way.
Code:
function getPoints() {
return [
//new google.maps.LatLng(-26.20478566666, -51.0518355),
//new google.maps.LatLng(-26.265426, -51.10279483333),
// new google.maps.LatLng(-26.265426, -51.10279483333),
// new google.maps.LatLng(-26.22920166666, -51.08537583333),
// new google.maps.LatLng(-26.21230783333, -51.0784765),
// new google.maps.LatLng(-26.21460016666,-51.07964916666),
// new google.maps.LatLng(-26.21396566666, -51.076862),
// new google.maps.LatLng(-26.23305616666, -51.05080116666),
// new google.maps.LatLng(-26.2335205, -51.05153366666),
// new google.maps.LatLng(-26.22982933333, -51.08531783333),
// new google.maps.LatLng(-26.20052716666, -51.09534966666),
// new google.maps.LatLng(-26.22196833333, -51.05161116666),
// new google.maps.LatLng(-26.20052716666, -51.09534966666),
// new google.maps.LatLng(-26.22196833333, -51.05161116666),
// new google.maps.LatLng(-26.22650916666, -51.08625616666),
// new google.maps.LatLng(-26.22650916666, -51.08625616666),
// new google.maps.LatLng(-26.22196833333, -51.05161116666),
// new google.maps.LatLng(-26.22650916666, -51.08625616666)
downloadUrl("dados.xml", function(data)
{
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++)
{
var point = new google.maps.LatLng
(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng"))
);
};
}
);
];
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
The implementation I’m using is based on this example https://developers.google.com/maps/documentation/javascript/heatmaplayer?hl=pt-br#load_the_visualization_library
You can give an example of what this has
dados.xml
?– Sergio
Solved your doubt?
– durtto