From 75b32a935cb219a8372841cca076daf943448a12 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Sat, 17 Feb 2024 15:34:46 -0600 Subject: [PATCH] Update geocoder.py --- incident_scraper/external/geocoder.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/incident_scraper/external/geocoder.py b/incident_scraper/external/geocoder.py index e0a6d2f..9de9682 100644 --- a/incident_scraper/external/geocoder.py +++ b/incident_scraper/external/geocoder.py @@ -153,23 +153,26 @@ def _census_validate_address(self, address: str) -> dict: return self.address_cache[address] def _google_validate_coordinates( - self, original_addr: str, coords: [float, float] + self, original_addr: str, longitude: float, latitude: float ) -> dict: - logging.debug(f"Using the Google Maps reverse geocoder for: {coords}") - resp = self.google_client.reverse_geocode((coords[0], coords[1])) + logging.debug( + "Using the Google Maps reverse geocoder for: " + f"{longitude}, {latitude}" + ) + resp = self.google_client.reverse_geocode((longitude, latitude)) if resp: self.address_cache[original_addr] = { INCIDENT_KEY_ADDRESS: resp[0]["formattedAddress"].replace( ", USA", "" ), - INCIDENT_KEY_LATITUDE: coords[0], - INCIDENT_KEY_LONGITUDE: coords[1], + INCIDENT_KEY_LONGITUDE: longitude, + INCIDENT_KEY_LATITUDE: latitude, } else: logging.debug( "Unable to get result from the Google Maps reverse geocoder " - f"for: {coords}" + f"for: {longitude}, {latitude}" ) self.address_cache[original_addr] = None