How can I check if my lat/long is in the city limits or example, Greater London is enclosed by:
[bbox=-0.489,51.28,0.236,51.686]
Source :
http://wiki.openstreetmap.org/wiki/Bounding_Box
How can I check if a location (lat/lon):
51.55238,0.047032
Is there a gem already for this? Or what would be the best way to do this?
Bounty update:
I have a working solution but I feel its not the right one, I'm using geocoder gem, and my user has geocoded_by, and lat/long attributes. So here is how I do it :
def self.user_from_dublin(user_id)
near([53.349937,-6.261917], 15).pluck(:id).include?(user_id)
end
So this loads all users from Dublin and compares the id of the user to those users in Dublin. If the id is found the user is considered to be from Dublin.
I don't think this will work well when there is more users.
Update
I'm using postgres database