0

I'm using Googles services to get the corrdinates of a location entered into a search field. But Google seems to be changing the variable names returned for the longitude and latitude values.

Here is my code below where thisplace.geometry.location.H, thisplace.geometry.location.L are now J and M and this is the second time Google has done this! Is there another variable I can access that Google doesn't change?

google.maps.event.addListener(navbarAutocomplete, 'place_changed', function() {
  var thisplace = navbarAutocomplete.getPlace();

  if (thisplace.geometry !== undefined) { // run this when we click on autocomplete result or tab down and press returnwhen it's highlighted
    if (thisplace.geometry.location != null) {
      GetResults(thisplace.geometry.location.H, thisplace.geometry.location.L, thisplace.types[0]);
    } else {
      GetResults("", "", "");
    }
  } else {
    GetPlace();
  }
});
chuckd
  • 13,460
  • 29
  • 152
  • 331
  • 1
    `thisplace.geometry.location.lat()` to get the latitude and `thisplace.geometry.location.lng()` for the longitude. **Do NOT** use thisplace.geometry.location.L or thisplace.geometry.location.H – ihimv Oct 08 '15 at 09:46
  • 1
    related question: [google.maps.Geocoder.geocode() geometry.location lat/lng property names change frequently](http://stackoverflow.com/questions/13499111/google-maps-geocoder-geocode-geometry-location-lat-lng-property-names-change-f) – geocodezip Oct 08 '15 at 12:50

0 Answers0