This is driving me nuts, for some reason the API used to return the Lat and Lon like this:
(I think it was like this):
place.geometry.location.y as Latitude
place.geometry.location.z as Longitude
Then it started returning it like this:
place.geometry.location.Ya as Latitude
place.geometry.location.Za as Longitude
And today my APP wasn’t working and I discovered that it was because the Google API was returning the Lat and Lon like this:
place.geometry.location.$a as Latitude
place.geometry.location.ab as Longitude
wtf? How am I supposed to work with this? I’m thinking on simply reading the first variable inside locations as Latitude and the second as Longitude regardless their names. But I’m afraid the API might return a completely different object next time and mess up my javascript.
Anyone experienced this? What am I supposed to do?
place.geometry.location consists by LatLng class.
So if you want to get Latitude/Longitude, you should use like this code:
And the reference of the place.geometry.location is here.
https://developers.google.com/maps/documentation/javascript/reference#PlaceGeometry