I am trying to do a simple geocode operation that I have been able to do many times in the past. This simple code no longer works, because it returns this output. {'States': [], 'Counties': [], '2020 Census Blocks': [], 'Census Tracts': []}. What could possibly explain this? I have run this code many times in the past and I have never seen this before.
import censusgeocode as cg
census = cg.coordinates(x=40.81918, y=-83.29061)
census
x
is the longitude and y
is the latitude. You need to swap them, like this:
census = cg.coordinates(x=-83.29061, y=40.81918)
From the Geocoding Services Web Application Programming Interface (API):
x,y (searchtype = coordinates)
– The longitude and latitude represented as decimal x/y values. Only returns geoLookup data. Can only be used with returntype = geographies.