From 368398502fb2fb4834e32a7fd37cd139cbb91542 Mon Sep 17 00:00:00 2001 From: Gelinger Media Date: Fri, 1 Nov 2019 11:57:30 +0100 Subject: [PATCH 1/3] Make the Nominatim URL Configurable --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f2af0bee..c07caf14 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 = { From 143d56d6e0654c2dc104d8143f1a067d10bab915 Mon Sep 17 00:00:00 2001 From: Gelinger Media Date: Fri, 1 Nov 2019 12:01:27 +0100 Subject: [PATCH 2/3] Make Nominatim URL Configurable --- src/leaflet_options.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/leaflet_options.js b/src/leaflet_options.js index 4885c9d5..9988f2d8 100644 --- a/src/leaflet_options.js +++ b/src/leaflet_options.js @@ -42,6 +42,10 @@ module.exports = { overlay: { 'Small Components': small_components }, + nominatim:{ + + url:'//nominatim.openstreetmap.org/' + }, baselayer: { one: streets, two: outdoors, From 55c028c9453caf3106515a1c57d81fb5e85fb9f1 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Mon, 5 Oct 2020 18:42:52 +0200 Subject: [PATCH 3/3] :whale: Docker configuration for nominatim Signed-off-by: mathieu.brunot --- README.md | 3 +++ docker/Dockerfile | 1 + scripts/replace.js | 2 ++ src/leaflet_options.js | 3 +-- 4 files changed, 7 insertions(+), 2 deletions(-) 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 b2075365..de254353 100755 --- a/scripts/replace.js +++ b/scripts/replace.js @@ -19,8 +19,10 @@ 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' // 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/leaflet_options.js b/src/leaflet_options.js index 9988f2d8..cfffe3ca 100644 --- a/src/leaflet_options.js +++ b/src/leaflet_options.js @@ -43,8 +43,7 @@ module.exports = { 'Small Components': small_components }, nominatim:{ - - url:'//nominatim.openstreetmap.org/' + url:'//nominatim.openstreetmap.org/' }, baselayer: { one: streets,