I have this code:
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(0, 0);
var myOptions = {
zoom: 1,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: results[0].geometry.location
});
document.getElementById("latlng").value =
address.lat() + ', ' + address.lng();
} else {
alert("Geocode was not successful for the following reason: "
+ status);
}
});
}
But do not get to tou put inside the latlng input the latitude and
longitude:
document.getElementById ("latlng). address.lat value = () + '' +
address.lng ();
And another doubt is how can I clear the screen so that there is only
one marker in clearOverlays used the v2 () v3 but I'm not fishing
anything.
Hope you can help me
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
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.