My model in db has .city_lat & .city_lon attributes. I extract the
values for those from Geocoder's result, from .geometry.location. The
issue I'm facing is that the location object returns latitude and
longitude objects under names that keep changing.
For example, some time ago, I had in my code:
$('#city_lat').val(_data.geometry.location.a)
$('#city_lon').val(_data.geometry.location.b)
now, I have to have:
$('#city_lat').val(_data.geometry.location.b)
$('#city_lon').val(_data.geometry.location.c)
.location.a was changed into .location.b for latitude, similarly for
longitude.
Why is that? But more importantly, how do I code it so I don't have to
continuously check for google's changes of the longitude and latitude
objects names?
thanks,
martin
If you'll take a look at the LatLng object documentation:
http://code.google.com/apis/maps/documentation/v3/reference.html#LatLng
- you can use the lat() and lng() methods to retrieve the values.
$('#city_lat').val(_data.geometry.location.lat())
$('#city_lon').val(_data.geometry.location.lng())
Chad Killingsworth
On Mar 30, 7:15 pm, Chad Killingsworth