aboutsummaryrefslogtreecommitdiffstats
path: root/fnme/geo.py
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2026-05-03 19:56:20 +0100
committerAlex Schofield <git@ajschof.me>2026-05-03 19:56:20 +0100
commitcd38f633c2730804f502cb5b0f461c79b906cd53 (patch)
tree93fd19349e0f60ca4d8708ead9014a3cb9e9c50a /fnme/geo.py
parent35b68e14162c722c3103f2a6168f0ab205e9c2c2 (diff)
parent4264ced9fa14b689acc18169b2c1cae72d3ce667 (diff)
downloadfuelnearme-cd38f633c2730804f502cb5b0f461c79b906cd53.tar.gz
fuelnearme-cd38f633c2730804f502cb5b0f461c79b906cd53.zip
merge: uv-migration into main
Diffstat (limited to 'fnme/geo.py')
-rw-r--r--fnme/geo.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/fnme/geo.py b/fnme/geo.py
new file mode 100644
index 0000000..dba68fe
--- /dev/null
+++ 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)
git.ajschof.me — hosted by ajschofield — powered by cgit