Hi, I am trying to print (geolocator.reverse('40.759516, -73.955443', distance='100')) on an location without an address within the distance parameter. I want to iterate through a list of locations, and store the locations that return a valid address. For example, if I run a iteration with coordinates over New York, I want to store all locations that actually have an address within the set distance. However, now, when there is no address within my set distance, I get an error:
Traceback (most recent call last):
File "./google.py", line 28, in <module>
location = geolocator.reverse(water, distance='100')
File "/home/strix/anaconda3/lib/python3.5/site-packages/geopy/geocoders/arcgis.py", line 202, in reverse
raise GeocoderServiceError(str(response['error']))
geopy.exc.GeocoderServiceError: {'code': 400, 'message': 'Cannot perform query. Invalid query parameters.', 'details': ['Unable to find address for the specified location.']}
Any ideas how to write a code that can handle such an error? Is it even possible since my script actually crashes (I am quite new to python, so please excuse any noob language).
My code:
from geopy.geocoders import ArcGIS
geolocator = ArcGIS()
location = geolocator.reverse('40.759516, -73.955443', distance='100')
print (location)
Thanks,
Nils