feat: add logging and string representation
This commit is contained in:
parent
74f54c7b31
commit
7c076e0bc3
@ -123,12 +123,14 @@ class GeoAPI:
|
|||||||
def get_geojson_for_query(self, location_string):
|
def get_geojson_for_query(self, location_string):
|
||||||
try:
|
try:
|
||||||
if self.api_format == 'nominatim':
|
if self.api_format == 'nominatim':
|
||||||
|
logging.info(f"Querying nominatim instance for: {location_string} ({self.api_url})")
|
||||||
result = self.requests.get(self.api_url,
|
result = self.requests.get(self.api_url,
|
||||||
{"q": location_string,
|
{"q": location_string,
|
||||||
"format": "jsonv2"},
|
"format": "jsonv2"},
|
||||||
headers=self.headers).json()
|
headers=self.headers).json()
|
||||||
geofeatures = GeoFeature.geofeatures_from_nominatim_result(result)
|
geofeatures = GeoFeature.geofeatures_from_nominatim_result(result)
|
||||||
elif self.api_format == 'photon':
|
elif self.api_format == 'photon':
|
||||||
|
logging.info(f"Querying photon instance for: {location_string} ({self.api_url})")
|
||||||
result = self.requests.get(self.api_url,
|
result = self.requests.get(self.api_url,
|
||||||
{"q": location_string},
|
{"q": location_string},
|
||||||
headers=self.headers).json()
|
headers=self.headers).json()
|
||||||
@ -167,6 +169,9 @@ class LocationProxy:
|
|||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.place_id == other.place_id
|
return self.place_id == other.place_id
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def position(self):
|
def position(self):
|
||||||
return (self.latitude, self.longitude)
|
return (self.latitude, self.longitude)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user