Let\'s say I have a LatLng object, is there any way of checking if it represents a possible location within a city? How can I get the limits of a city? I\'m using Google Map
Have you tried reverse geocoding?
http://code.google.com/apis/maps/documentation/javascript/services.html#ReverseGeocoding
You could check the formatted address to see if the city matches what you're looking for. I'm not sure how accurate this will be for your application, but it's an option.
function codeLatLng() {
var geocoder = new google.maps.Geocoder(),
latlng = new google.maps.LatLng(40.730885, -73.997383);
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
console.log(results[1]);
console.log(results[1].formatted_address);
}
} else {
alert("Geocoder failed due to: " + status);
}
});
}