Google Maps autocomplete api v3 suddenly stopped working

Thus, I unexpectedly discovered that, after changing the code in general, the Google Autocomplete API completely stopped working. I inferred the results to see what happens.

I previously got lat lng from an autocomplete address as follows:

new google.maps.LatLng(from_autocomplete.getPlace().geometry.location.d, from_autocomplete.getPlace().geometry.location.e); 

d and e - armor and lng-coordinates. I found that the error is that the response from the autocomplete object (autocomplete.getPlace (). Geometry.location) is now:

 k: 53.002668, A: -2.179403999999977 

Why does d and e suddenly change to K and A? He worked for several weeks, and then this changed without warning.

+1
autocomplete google-maps
source share
2 answers

You used the properties of the internal structure of the object, which can change at any time.

geometry is of type google.maps.places.PlaceGeometry with the location property, which is the google.maps.LatLng class. You can get latitude and longitude using the officially supported lat() and lng() methods.

+2
source share

I had a similar problem. Google Maps and autocomplete unexpectedly do not work, I follow these steps.

-make "YOUR_API_KEY" from the Google developer console ( https://console.developers.google.com ) then enable the following actions (with the Enable button) for the current project in the developer console

Maps API JavaScript
Google Places Google Web API
Map Geocoding API

Google Maps Geolocation API (these are important features that you can also enable if you want)

after that my problem is solved

+1
source share

All Articles