Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📍 Store the entire nominatim response; not just 'address' #973

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion emission/analysis/intake/cleaning/clean_and_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def get_filtered_place(raw_place):
reverse_geocoded_json = eco.Geocoder.get_json_reverse(filtered_place_data.location.coordinates[1],
filtered_place_data.location.coordinates[0])
if reverse_geocoded_json is not None:
filtered_place_data['geocoded_address'] = reverse_geocoded_json['address']
filtered_place_data['reverse_geocode'] = reverse_geocoded_json
filtered_place_data.display_name = format_result(reverse_geocoded_json)
except KeyError as e:
logging.info("nominatim result does not have an address, skipping")
Expand Down
2 changes: 1 addition & 1 deletion emission/core/wrapper/cleanedplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Cleanedplace(ecwp.Place):
props = ecwp.Place.props
props.update(
{"raw_places": ecwb.WrapperBase.Access.WORM, # raw places that were combined to from this cleaned place
"geocoded_address": ecwb.WrapperBase.Access.WORM, # the 'address' field of the OSM reverse geocoding result
"reverse_geocode": ecwb.WrapperBase.Access.WORM, # the 'address' field of the OSM reverse geocoding result
"display_name": ecwb.WrapperBase.Access.WORM # The human readable name for this place
})

Expand Down
8 changes: 4 additions & 4 deletions emission/individual_tests/TestNominatim.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def test_get_filtered_place(self):
actual_display_name = fake_place_data.__getattr__("display_name")
expected_display_name = "Dorrance Street, Providence"
self.assertEqual(expected_display_name, actual_display_name)
actual_geocoded_address = fake_place_data["geocoded_address"]
expected_geocoded_address = {'road': 'Dorrance Street', 'city': 'Providence', 'postcode': '02903'}
for k in expected_geocoded_address:
self.assertEqual(expected_geocoded_address[k], actual_geocoded_address[k])
actual_reverse_geocode = fake_place_data["reverse_geocode"]
expected_address = {'road': 'Dorrance Street', 'city': 'Providence', 'postcode': '02903'}
for k in expected_address:
self.assertEqual(expected_address[k], actual_reverse_geocode['address'][k])

#Testing make_url_geo, which creates a query URL from the input string.
def test_make_url_geo(self):
Expand Down
Loading