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

✨ Docker configuration for nominatim #327

Open
wants to merge 5 commits into
base: gh-pages
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ docker run -p 9966:9966 osrm/osrm-frontend
Per default routing requests are made against the backend at `http://localhost:5000`.
You can change the backend by using `-e OSRM_BACKEND='http://localhost:5001'` in the `docker run` command.

Per default address requests are made against the Nominatim demo at `https://nominatim.openstreetmap.org`.
You can change the Nominmatim instance by using `-e NOMINATIM_URL='http://localhost:8080'` in the `docker run` command.

In case Docker complains about not being able to connect to the Docker daemon make sure you are in the `docker` group.

```
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV OSRM_CENTER='38.8995,-77.0269'
ENV OSRM_ZOOM='13'
ENV OSRM_LANGUAGE='en'
ENV OSRM_LABEL='Car (fastest)'
ENV NOMINATIM_URL='https://nominatim.openstreetmap.org'

# Copy package.json
RUN mkdir -p /src
Expand Down
2 changes: 2 additions & 0 deletions scripts/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ for (const filepath of [leafletOptions, debug]) {
const CENTER = process.env.OSRM_CENTER || '38.8995, -77.0269'
const BACKEND = process.env.OSRM_BACKEND || 'https://router.project-osrm.org'
const LANGUAGE = process.env.OSRM_LANGUAGE || 'en'
const NOMINATIM = process.env.NOMINATIM_URL || 'https://nominatim.openstreetmap.org'
const DEFAULT_LAYER = process.env.OSRM_DEFAULT_LAYER || 'streets'

// Edit Leaflet Options
if (NOMINATIM) options = options.replace(/\/\/nominatim\.openstreetmap\.org/, NOMINATIM)
if (BACKEND) options = options.replace(/http[s]?:\/\/router\.project-osrm\.org/, BACKEND)
if (LABEL) options = options.replace('Car (fastest)', LABEL)
if (ZOOM) options = options.replace('zoom: 13', `zoom: ${ZOOM}`)
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function makeIcon(i, n) {
}

var plan = new ReversablePlan([], {
geocoder: Geocoder.nominatim(),
geocoder: Geocoder.nominatim({serviceUrl:leafletOptions.nominatim.url}),
routeWhileDragging: true,
createMarker: function(i, wp, n) {
var options = {
Expand Down
3 changes: 3 additions & 0 deletions src/leaflet_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ module.exports = {
overlay: {
'Small Components': small_components
},
nominatim:{
url:'//nominatim.openstreetmap.org/'
},
baselayer: {
one: streets,
two: outdoors,
Expand Down