On my map I have some Markers. Onclick I want to get the markers address using reserve geocoding.
Here is my function:
...
google.maps.event.addListener(marker_obj[ii], 'click', function(){
show_marker_information(this);
});
...
function show_marker_information(obj){
//obj = marker
if(typeof(infowindow) != 'undefined')
infowindow.close();
var latlng_search = obj.getPosition();
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
'latlng': latlng_search
},
function(results, status){
alert(results.toSource());
}
);
When clicking on a marker firebug tells me:
Unknown property <latlng>
[Break On This Error] J.toSpan=function(){return new P(this....n(d){return d==k&&c||d instanceof a}}
Any ideas?
I found my error:
geocoder.geocode({
'latlng': latlng_search
},
function(results, status){
alert(results.toSource());
}
);
there is no 'latlng' property at geocoder. it has to be 'location' instead of 'latlng'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.