Skip to content

Change geocoder to use OSM - #145

Merged
paigewilliams merged 3 commits into
mainfrom
change-geocoder-osm
Sep 3, 2026
Merged

Change geocoder to use OSM#145
paigewilliams merged 3 commits into
mainfrom
change-geocoder-osm

Conversation

@paigewilliams

Copy link
Copy Markdown
Contributor

asana task

Changes the default service in the geocode view to use OSM's Nominatim. I kept in the logic to support using an ArcGIS geocoding service, but I am open to removing the code since we don't plan on using this service.

One key piece of logic we needed to change is hard-coding the contextual_hits, as opposed to hitting the geocoding API with the context. This was necessary because the Nominatim API only allows max 1 request per second, so hitting it again would violate the usage policy.

Also, for the ArcGIS geocoding API, we are using the geocoder python library. This library has not been updated to support the required headers for Nominatim API, so we have to just hit the API directly.

@paigewilliams paigewilliams self-assigned this Sep 1, 2026

@rhodges rhodges left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I can't wait to see it in action!

Comment thread landmapper/app/views.py
elif service.lower() == 'osm':
headers = {
"User-Agent": "Landmapper (Contact: ksdev@ecotrust.org)",
"Referer": "https://landmapper.ecotrust.org/"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. This might be oregon.landmapper.ecotrust.org or washington.landmapper.ecotrust.org. It's probably best to leave this alone for now, rather than insert a constant from .env/settings.py.

@paigewilliams
paigewilliams merged commit f442af5 into main Sep 3, 2026
1 check passed
@paigewilliams
paigewilliams deleted the change-geocoder-osm branch September 3, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants