Make nominatim endpoint modifiable#385
Make nominatim endpoint modifiable#385nhirokinet wants to merge 1 commit intoProject-OSRM:gh-pagesfrom
Conversation
|
Hi, thank you for review! You've set auto merge and approved, so once the conflicts are resolved, I think the PR will be automatically merged. |
|
Please resolve the merge conflict |
Most of API endpoints can be modified via leaflet_options.js, which is mentioned in README as a target of manual modify. But nominatim endpoint cannot be modified by this way. As nominatim can be self-hosted, I think it should be modifiable in configuration.
Head branch was pushed to by a user without write access
|
I resolved the merge conflict and tested again. |
There was a problem hiding this comment.
Pull request overview
This PR makes the Nominatim (forward/reverse geocoding) endpoint configurable, aligning it with other backend endpoints that can be customized via src/leaflet_options.js and the build-time replacement script.
Changes:
- Add a
nominatim.pathconfiguration entry tosrc/leaflet_options.js. - Wire the configured Nominatim URL through
src/index.jsinto the geocoder factory. - Allow build-time substitution of the Nominatim endpoint via
scripts/replace.js.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/leaflet_options.js | Introduces a configurable Nominatim base URL in the exported options. |
| src/index.js | Passes the configured Nominatim URL into the geocoder initialization. |
| src/geocoder.js | Updates coordPreserving to build a Nominatim geocoder using a configurable serviceUrl. |
| scripts/replace.js | Adds env-driven replacement for the Nominatim endpoint in generated config files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| geocoder.coordPreserving = function(nominatimUrl) { | ||
| var nominatim = L.Control.Geocoder.nominatim({serviceUrl: nominatimUrl}); |
| } | ||
| var plan = new ReversablePlan([], { | ||
| geocoder: createGeocoder.coordPreserving(), | ||
| geocoder: createGeocoder.coordPreserving(leafletOptions.nominatim.path), |
| // Leaflet uses LatLng | ||
| else options = options.replace('38.8995,-77.0269', latlng) | ||
| } | ||
| if (NOMINATIM_ENDPOINT) options = options.replace('https://nominatim.openstreetmap.org/', NOMINATIM_ENDPOINT) |
| }, | ||
| nominatim: { | ||
| path: 'https://nominatim.openstreetmap.org/' | ||
| } |
Hi, thank you for nice product.
How about make nominatim endpoint modifiable?
I tried to make my code fit to current code, but if there is comment please feel free to comment about modification.
(The following is the commit message)
Most of API endpoints can be modified via leaflet_options.js, which is mentioned in README as a target of manual modify.
But nominatim endpoint cannot be modified by this way. As nominatim can be self-hosted, I think it should be modifiable in configuration.