to_town
Find nearby towns of a geographic latitude and longitude. Currently it only has US locations. Other data sources can be added if available.
Usage
-
Install the gem: gem install to_town
-
add to_town to your Gemfile
-
add require ‘to_town’ to your code
-
You can get a list of nearby points by calling ToTown.check(some_latitude_value, some_longitude_value, results_limit)
Command line:
-
run ‘to_town config` to generate a mongoid.yml in the current directory
-
run ‘to_town populate` to load the data to mongodb
-
run ‘to_town –lat=some_latitude_value –lng=some_longitude_value` to check the result
Example:
to_town check –lat=45.018625 –lng=-93.239039 –limit=10
St. Anthony MN
type: city
latitude: 45.027324
longitude: -93.215533
land area: 5831140
water area: 305693
Columbia Heights MN
type: city
latitude: 45.049104
longitude: -93.246749
land area: 8832769
water area: 284420
Hilltop MN
type: city
latitude: 45.053564
longitude: -93.250129
land area: 310173
water area: 0
Lauderdale MN
type: city
latitude: 44.994407
longitude: -93.203134
land area: 1086715
water area: 2752
New Brighton MN
type: city
latitude: 45.064894
longitude: -93.209271
land area: 16731107
water area: 1545061
Minneapolis MN
type: city
latitude: 44.963324
longitude: -93.268284
land area: 139789184
water area: 9052448
Fridley MN
type: city
latitude: 45.084246
longitude: -93.26005
land area: 26329217
water area: 1873882
Falcon Heights MN
type: city
latitude: 44.988048
longitude: -93.174718
land area: 5785375
water area: 16906
Roseville MN
type: city
latitude: 45.015422
longitude: -93.155011
land area: 33679465
water area: 2168129
Arden Hills MN
type: city
latitude: 45.071161
longitude: -93.165504
land area: 22253249
water area: 2743210
Data source
-
US 2010 Census www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt.
Contributing to to_town
-
Fork the project
-
Start a feature/bugfix branch
-
Send pull request
Copyright
Copyright © 2011 zhengjia. See LICENSE.txt for further details.