Latitude and Longitude check with in range

Hi ,

I have city or county Lat and Long and if user inputs of lat and long are with in the city or county which I specify then I should allow him for next page else I need to block him and say we are not serving at that place. Using Geocoder I don’t see any method to check lat and long with in range. Can any one help me how can I do this.

Thanks in advance

A Range is standard Ruby, nothing Geocoder-specific about it. What does an example lat/long "range" look like?

Otherwise, is there some reason Thing.near() doesn't work for your use case?

Hi Hassan.

You will need to specify a collection of points that define an County or City


Define a set of list of points set([lat,long],…) or [ [lat,long],…]

If location in set or list accept



Uh, no, not my question.


Geocoding refers to the translation of an address to a lat/lng or vice-versa.

If you’re looking to determine if a lat/lng is within a City or County shape, you’re probably looking for something like a Point-in-Polygon search - to ensure the lat/lng is within a given boundary.

Rails offers nice PostGIS support. ST_Contains

There are likely other options as well, depending on where you store your shapefiles.

  • Ryan