Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Jun 23, 2023
1 parent 01df9fa commit 8a30494
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions maploc/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def read_input_image(
raise ValueError("geocoding unavailable, install geopy.")
location = geolocator.geocode(prior_address)
if location is None:
logger.info("Could not find any location for %s.", prior_address)
logger.info("Could not find any location for address '%s.'", prior_address)
else:
logger.info("Using prior address: %s", location.address)
logger.info("Using prior address '%s'", location.address)
latlon = (location.latitude, location.longitude)
if latlon is None:
geo = exif.extract_geo()
Expand All @@ -107,9 +107,11 @@ def read_input_image(
latlon = (geo["latitude"], geo["longitude"], alt)
logger.info("Using prior location from EXIF.")
else:
logger.info("Could not find any prior location in EXIF.")
logger.info("Could not find any prior location in the image EXIF metadata.")
if latlon is None:
raise ValueError("Need prior latlon")
raise ValueError(
"No location prior given: maybe provide the name of a street, building or neighborhood?"
)
latlon = np.array(latlon)

proj = Projection(*latlon)
Expand Down

0 comments on commit 8a30494

Please sign in to comment.