Polylin google maps com json
Olá pessoal, eu preciso da ajuda de vocês pra inserir o Polylin no meu mapa, eu tenho o seguinte código:
var qtd;
var retorno;
$.getJSON('http://voemercosul.com/v2/action.php/acars/trackAirplane', function(data){
this.qtd = data.bindings.length;
this.retorno = '';
for (i = 0; i < this.qtd; i++){
/* this.retorno += 'ID: ' + data.usuarios[i].id + '<br />';
this.retorno += 'Nome: ' + data.usuarios[i].nome + ' - ';
this.retorno += 'Cidade: ' + data.usuarios[i].cidade + '<br /><br />';*/
/*SÃO ESSAS AS VARIÁVEIS QUE EU GOSTARIA DE INSERI NO POLYLIN DO MAPA*/
this.retornolat = data.bindings.latitude;
this.retornolon = data.bindings.longitude;
}
//flightPlanCoordinates2[i] = new google.maps.LatLng(this.retornolat, this.retornolon);
//alert(flightPlanCoordinates2[i]);
});
// Objeto.
var obj = new json();
obj.resgatarValores();
var flightPlanCoordinates = [
/EU GOSTARIA DE INSERIR OS VAROES RETORNADOS DO JSON AQUI MAS NÃO CONSIGO ME AJUDEM COM ISSO POR FAVOR/
//new google.maps.LatLng(37.772323, -122.214897),
//new google.maps.LatLng(21.291982, -157.821856),
//new google.maps.LatLng(-18.142599, 178.431),
//new google.maps.LatLng(-27.46758, 153.027892)
];
flightPath2 = new google.maps.Polyline({
path: flightPlanCoordinates2,
strokeColor: "#04B431", strokeOpacity: 1.0, strokeWeight: 2
});
flightPath2.setMap(map);
flightPath = new google.maps.Polyline({
path: path,
strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2
});
map.fitBounds(focus_bounds);
flightPath2.setMap(map);
});
Então pessoal, eu queria inserir a latitude e a longitude que recebo do json no polylin do mapa. Alguem me ajude pf.. :upset:
Discussão (6)
Carregando comentários...