I have millions of lat,long pairs which I want to convert to FIPS county codes that match with the US census data. In the past I used the census block api but that is too slow for the amount of numbers that I have. Is there a better library / tool that I can load locally ? If not would be possible to use the TIGER data from the census website to create a service like that ? What knowledge is required (projections, minimum distances, ...) ?
3 Answers
Please check out http://www.datasciencetoolkit.org/ a ready to use virtual machine(VM) for geocoding and reverse geocoding, it provides useful information including FIPS codes.
i hope it will help.
-
-
Yes, @fabrizioM Its a really power toolkit to do offline geocoding & reverse geocoding. Nov 13, 2013 at 6:01
-
Is there anyone offering a paid hosted service? I want to convert my lat/longs to FIPS codes, but I'd prefer to pay a small monthly fee instead of hosting this service myself. Jul 28, 2017 at 18:56
-
@Lucas. Please check out fcc.gov/developer/census-block-conversions-api. I hope it will help. Jul 30, 2017 at 6:15
-
See this FFC site, it has moved: https://geo.fcc.gov/api/census/#!/area/get_area
And some python 3 code to get the data:
import urllib, json, requests
with urllib.request.urlopen("https://geo.fcc.gov/api/census/area?lat=42.3295&lon=-71.0826&format=json") as url:
data = json.loads(url.read().decode())
print(data)
print(json.dumps(data, indent=4, sort_keys=True))
print(data['results'][0]['state_fips'])
print(data['results'][0]['county_fips'])
print(data['results'][0]['county_name'])
-
Has this API been taken down? The example URL gives me a 502 error. Dec 17, 2021 at 14:43
You can use FCC Conversion API
For example: http://data.fcc.gov/api/block/find?format=json&latitude=28.35975&longitude=-81.421988&showall=true
-
1That API has been deprecated. @Martien's answer has the replacement API. Mar 1, 2021 at 15:58