Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps Geocoder not giving results
    primarykey
    data
    text
    <p>I am using Google Maps V3 API and using its Geocoder to do reverse geocoding of the point on the map where the user clicks on.</p> <p><strong>Load the geocoding function when DOM is fully loaded</strong></p> <pre><code>$(function() { reverse_geocode(40.714224,-73.961452); </code></pre> <p>});</p> <p><strong>Function that does the reverse geocoding</strong>:</p> <pre><code>function reverse_geocode(lat,lng) { var geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(10,-10); geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { alert('asdasd'); } else { alert("Geocoder failed due to: " + status); } }); </code></pre> <p>}</p> <p>If I call the <code>reverse_geocode</code> function when the page first loads, everything works fine and the <code>alert()</code> is called.</p> <p>However, if I call <code>reverse_geocode()</code> only when triggered by a rightclick on the map followed by a mouseclick on a div, using the code below, nothing happens! Any idea what went wrong?</p> <pre><code>google.maps.event.addListener(map, "rightclick", function(event) { //some code not shown $("#info_rightclick_top").click(function(e) { info_ok_handleclick(); }); }); function info_ok_handleclick() { $("#info_ok").click(function(e) { var lat = marker_search_location.getPosition().lat(); var lng = marker_search_location.getPosition().lng(); var latlng = lat + "_" + lng; reverse_geocode(10,-10); // some code hidden }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload