I currently am working on a piece of code in Python that takes in a csv file of latitude and longitude coordinates and returns a new csv file with the corresponding county codes. How would I go about linking each coordinate with a county code? I am aware of the reverse_geocoder python package, but this only returns the name of each county. Is there any tool that returns county code?
If you have the shape definitions for the counties, you can do your own search using a simple point-in-polygon search.
This would be greatly speeded up by using a spatial index, searching the spatial extents (ie. n/s/w/e extents) and then only performing the point-in-polygon when there is an overlap in extents.
Assuming you're in the US and not working with the Aleutians, then you can probably assume Euclidean coordinates for the point-in-polygon. True point-in-polygon on a sphere is more complicated...