Eu estou com um problema com o código abaixo: geocoder.geocode retorna status = google.maps.GeocoderStatus.OK results[0].geometry.location = ROOFTOP results[0].formatted_address = 'R.Voluntários da Pátria, Botafogo, etc... results[0].geometry.location.LatLng.lat() =* undefined* results[0].geometry.location.LatLng.lngt() =* undefined* como isso é possível?
I've got a problem with the code below:
geocoder.geocode returns
status = google.maps.GeocoderStatus.OK
results [0]. geometry.location = ROOFTOP
results[0].formatted_address = 'R.Voluntários da Pátria, Botafogo,
etc...
results [0]. geometry.location.LatLng.lat () = *undefined*
results [0]. geometry.location.LatLng.lngt () = *undefined*
how is this possible?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
var centerLongitude = '-47.93000';
var centerLatitude = '-15.78000';
var geocoder;
function codeAddress(endereco) {
geocoder.geocode( { address: endereco}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert(results[0].formatted_address);
alert(results[0].geometry.location.LatLng.lat());
alert(results[0].geometry.location.LatLng.lng());
var latlng = results[0].geometry.location;
map.setCenter(latlng);
var marker = new google.maps.Marker({
map: map,
position: latlng,
draggable: true
});
} else {
alert("Geocode was not successful for the following reason: " +
status);
}
});
}
function init() {
// o mapa
var latlng = new google.maps.LatLng(centerLatitude,
centerLongitude);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new
google.maps.Map(document.getElementById("mapa"),myOptions);
geocoder = new google.maps.Geocoder();
codeAddress('RUA VOLUNTARIOS DA PATRIA BOTAFOGO RIO DE JANEIRO RJ');
}
</script>
</head>
<body style="margin: 0; padding: 0; width: 100%; height: 100%;"
onload="init()">
<form name="FrmCnes">
<div id="mapa" style="width:100%; height:100%"></div>
</form>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/b6gNa0eAKuIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.
