Alain Zelink
Alain Zelink

Reputation: 899

'item.geometry.location.kb' and 'item.geometry.location.jb' returning undefined

I'm using Google Maps to get an autocomplete list of cities.

I used to use item.geometry.location.kb as the longitude and item.geometry.location.jb as the latitude, but they are not defined since today/yesterday.

Apparently, one has to use item.geometry.location.lng() and .lat() instead.

I didn't know that and I have an app using item.geometry.location.kb and jb in Google Play and the App Store.

So my apps are not working any more.

Why has a change has been made and how can I revert to kb and jb?

autocomplete = new google.maps.places.Autocomplete(input, options);

google.maps.event.addListener(autocomplete, 'place_changed', function(event) {

    var item = autocomplete.getPlace();

    curLon = item.geometry.location.kb;
    curLat = item.geometry.location.jb;

    // ...

Upvotes: 0

Views: 2427

Answers (1)

geocodezip
geocodezip

Reputation: 161384

Don't use undocumented properties of the Google APIs. They can and do change with every release.

geometry.location is a google.maps.LatLng object, and the documented methods to get latitude and longitude are .lat() and .lng().

Upvotes: 3

Related Questions