diff --git a/README.md b/README.md index 5a553f3b..f29b18cc 100644 --- a/README.md +++ b/README.md @@ -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. ``` diff --git a/docker/Dockerfile b/docker/Dockerfile index 40308809..da9fcdeb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 diff --git a/scripts/replace.js b/scripts/replace.js index 55dea519..1700887c 100755 --- a/scripts/replace.js +++ b/scripts/replace.js @@ -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}`) diff --git a/src/index.js b/src/index.js index 3d694316..df7e7aa7 100644 --- a/src/index.js +++ b/src/index.js @@ -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 = { diff --git a/src/leaflet_options.js b/src/leaflet_options.js index 29f633f3..089a5c2e 100644 --- a/src/leaflet_options.js +++ b/src/leaflet_options.js @@ -59,6 +59,9 @@ module.exports = { overlay: { 'Small Components': small_components }, + nominatim:{ + url:'//nominatim.openstreetmap.org/' + }, baselayer: { one: streets, two: outdoors,