From 7c076e0bc3615a253a8426eb16cd4db510474327 Mon Sep 17 00:00:00 2001 From: moanos Date: Tue, 7 Jan 2025 15:04:43 +0100 Subject: [PATCH] feat: add logging and string representation --- src/fellchensammlung/tools/geo.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fellchensammlung/tools/geo.py b/src/fellchensammlung/tools/geo.py index 760998f..cfaec6b 100644 --- a/src/fellchensammlung/tools/geo.py +++ b/src/fellchensammlung/tools/geo.py @@ -123,12 +123,14 @@ class GeoAPI: def get_geojson_for_query(self, location_string): try: if self.api_format == 'nominatim': + logging.info(f"Querying nominatim instance for: {location_string} ({self.api_url})") result = self.requests.get(self.api_url, {"q": location_string, "format": "jsonv2"}, headers=self.headers).json() geofeatures = GeoFeature.geofeatures_from_nominatim_result(result) elif self.api_format == 'photon': + logging.info(f"Querying photon instance for: {location_string} ({self.api_url})") result = self.requests.get(self.api_url, {"q": location_string}, headers=self.headers).json() @@ -167,6 +169,9 @@ class LocationProxy: def __eq__(self, other): return self.place_id == other.place_id + def __str__(self): + return self.name + @property def position(self): return (self.latitude, self.longitude)