我有一个带坐标的json在我的谷歌地图中创建一些折线 http://giroingiroinbicicletta.com/itinerari.json 我用jquery getJson得到这个,我将点传给google地图但是没有用,我不明白为什么
var map
function initialize() {
var mapOptions = {
zoom: 14,
center: new google.maps.LatLng(41.90381,12.488601),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById("mappa"), mapOptions);
}
function estraiTracciati() {
$.getJSON( "itinerari.json", function( data ) {
$.each(data, function() {
var percorsoArray = [];
$.each(this.punti, function() {
percorsoArray.push(new google.maps.LatLng(this));
})
var polyline = new google.maps.Polyline({
path: percorsoArray
});
percorsi.push(polyline);
polyline.setMap(map);
});
});
}
google.maps.event.addDomListener(window, 'load', initialize);
$(document).ready(function() {
estraiTracciati();
}