diff options
| author | Alex Schofield <git@ajschof.me> | 2026-05-03 18:31:26 +0100 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2026-05-03 18:31:26 +0100 |
| commit | d0e905285691d73f2cf7e45a88dbadf631620f0a (patch) | |
| tree | 3de262bd346732f8813252e8cf38c379cbd1d250 /fnme/geo.py | |
| parent | e6b342749ea516c536973b828b5f5eef951b4796 (diff) | |
| download | fuelnearme-d0e905285691d73f2cf7e45a88dbadf631620f0a.tar.gz fuelnearme-d0e905285691d73f2cf7e45a88dbadf631620f0a.zip | |
move all logic into fnme folder
Diffstat (limited to 'fnme/geo.py')
| -rw-r--r-- | fnme/geo.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fnme/geo.py b/fnme/geo.py index e69de29..dba68fe 100644 --- a/fnme/geo.py +++ b/fnme/geo.py @@ -0,0 +1,10 @@ +from geopy.geocoders import Nominatim +from geopy.location import Location + + +def get_location(address: str) -> tuple[float, float]: + geolocator = Nominatim(user_agent="FuelNearMe") + result = geolocator.geocode(address) + if not isinstance(result, Location): + raise ValueError(f"Failed to get location from address: '{address}'") + return (result.latitude, result.longitude) |
