il mio codice è così:
downloadUrl("php_to_xml.php", function(data)
{
var xml = parseXml(data);
var markers = xml.documentElement.getElementsByTagName("marker") ;
for (var i = 0; i < markers.length; i++)
{
var name = markers[i].getAttribute("Sigla");
var address = markers[i].getAttribute("Indirizzo");
var place = markers[i].getAttribute("Citta");
var geocodato = converti_indirizzo(address, place);
var marker = new google.maps.Marker(
{
map: map,
position: geocodato
});
}
});
e la funzione converti_indirizzo è la seguente:
function converti_indirizzo(address, place)
{
if (geocoder)
{
geocoder.geocode(
{'address' : place+' '+address}, function (results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
position : results[0].geometry.location;
return results[0].geometry.location;
alert (results[0].geometry.location);
}
else
{
alert("Il Servizio Geocode non ha trovato l_indirizzo "+place+' '+address+" . Motivo: "+status);
}
});
}
}
solo che l'alert (dell'if con l'indirizzo corretto),messo apposta per vedere cosa succede nel programma, mi restituisce UNDEFINED.
sono nelle vostre manine sante!

Rispondi quotando
