Bast38
Bast38

Reputation: 93

Use geopy.geocoders - Nominatim locally (in offline, without Internet)

I need to execute the script that follow locally, because It will turn on a computer not connected to Internet. I downloaded the last version of nominatim on the computer (Nominatim-4.4.0.tar.bz2), but I don't understand how I can call the file to use it

from geopy.geocoders import Nominatim

fichier_nominatim=".../Desktop/TEST/Nominatim-4.4.0.tar.bz2"

geolocator=Nominatim(user_agent="my_geocoder",database=fichier_nominatim)

latitude, longitude = 48.8566, 2.3522

location = geolocator.reverse((latitude, longitude), language="fr")
ville = location.raw.get("address", {}).get("city")

print(ville)

I tried to specified some options (as add database) but it crashes, and I didn't find any example to do that in a simple way

Upvotes: 0

Views: 158

Answers (0)

Related Questions