From 762274203ef891c3c615c3b36c2519b2a3986e69 Mon Sep 17 00:00:00 2001
From: Thomas NOEL <tnoel@entrouvert.com>
Date: Tue, 19 Feb 2019 15:54:27 +0100
Subject: [PATCH] use entrouvert.org GIS of openstreetmap.org (#13241)

---
 tests/test_api.py              | 6 +++---
 tests/test_backoffice_pages.py | 2 +-
 tests/test_workflows.py        | 4 ++--
 wcs/qommon/publisher.py        | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/test_api.py b/tests/test_api.py
index fe34e5a6..5a7d03a4 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -2238,18 +2238,18 @@ def test_reverse_geocoding(pub):
         resp = get_app(pub).get('/api/reverse-geocoding?lat=0&lon=0')
         assert resp.content_type == 'application/json'
         assert resp.body == json.dumps({'address': 'xxx'})
-        assert urlopen.call_args[0][0] == 'http://nominatim.openstreetmap.org/reverse?zoom=18&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
+        assert urlopen.call_args[0][0] == 'http://nominatim.entrouvert.org/reverse?zoom=18&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
 
         pub.site_options.add_section('options')
         pub.site_options.set('options', 'nominatim_reverse_zoom_level', '16')
         pub.site_options.write(open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w'))
         resp = get_app(pub).get('/api/reverse-geocoding?lat=0&lon=0')
-        assert urlopen.call_args[0][0] == 'http://nominatim.openstreetmap.org/reverse?zoom=16&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
+        assert urlopen.call_args[0][0] == 'http://nominatim.entrouvert.org/reverse?zoom=16&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
 
         pub.site_options.set('options', 'nominatim_key', 'KEY')
         pub.site_options.write(open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w'))
         resp = get_app(pub).get('/api/reverse-geocoding?lat=0&lon=0')
-        assert urlopen.call_args[0][0] == 'http://nominatim.openstreetmap.org/reverse?zoom=16&key=KEY&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
+        assert urlopen.call_args[0][0] == 'http://nominatim.entrouvert.org/reverse?zoom=16&key=KEY&format=json&addressdetails=1&lat=0&lon=0&accept-language=en'
 
         pub.site_options.set('options', 'reverse_geocoding_service_url', 'http://reverse.example.net/?param=value')
         pub.site_options.write(open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w'))
diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py
index 3d11a0bc..ff218424 100644
--- a/tests/test_backoffice_pages.py
+++ b/tests/test_backoffice_pages.py
@@ -1068,7 +1068,7 @@ def test_backoffice_map(pub):
     assert 'Plot on a Map' in resp.body
     resp = resp.click('Plot on a Map')
     assert 'data-geojson-url' in resp.body
-    assert 'tile.openstreetmap.org/' in resp.body
+    assert 'tiles.entrouvert.org/' in resp.body
 
     if not pub.site_options.has_section('options'):
         pub.site_options.add_section('options')
diff --git a/tests/test_workflows.py b/tests/test_workflows.py
index 2272bae0..0c27d93f 100644
--- a/tests/test_workflows.py
+++ b/tests/test_workflows.py
@@ -2541,7 +2541,7 @@ def test_geolocate_address(pub):
         http_get_page.return_value = (None, 200,
                 json.dumps([{'lat':'48.8337085','lon':'2.3233693'}]), None)
         item.perform(formdata)
-        assert 'http://nominatim.openstreetmap.org/search' in http_get_page.call_args[0][0]
+        assert 'http://nominatim.entrouvert.org/search' in http_get_page.call_args[0][0]
         assert urllib2.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
         assert int(formdata.geolocations['base']['lat']) == 48
         assert int(formdata.geolocations['base']['lon']) == 2
@@ -2552,7 +2552,7 @@ def test_geolocate_address(pub):
         http_get_page.return_value = (None, 200,
                 json.dumps([{'lat':'48.8337085', 'lon':'2.3233693'}]), None)
         item.perform(formdata)
-        assert 'http://nominatim.openstreetmap.org/search' in http_get_page.call_args[0][0]
+        assert 'http://nominatim.entrouvert.org/search' in http_get_page.call_args[0][0]
         assert urllib2.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
         assert 'key=KEY' in http_get_page.call_args[0][0]
         assert int(formdata.geolocations['base']['lat']) == 48
diff --git a/wcs/qommon/publisher.py b/wcs/qommon/publisher.py
index 68e9a9ae..62af6c47 100644
--- a/wcs/qommon/publisher.py
+++ b/wcs/qommon/publisher.py
@@ -937,14 +937,14 @@ class QommonPublisher(Publisher, object):
                   "<a href='https://openstreetmap.org'>OpenStreetMap</a> contributors, "\
                   "<a href='http://creativecommons.org/licenses/by-sa/2.0/'>CC-BY-SA</a>")
         attrs['data-tile-urltemplate'] = self.get_site_option('map-tile-urltemplate') or \
-                'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
+                'https://tiles.entrouvert.org/hdm/{z}/{x}/{y}.png'
         return attrs
 
     def get_reverse_geocoding_service_url(self):
         url = self.get_site_option('reverse_geocoding_service_url')
         if url:
             return url
-        url = self.get_site_option('nominatim_url') or 'http://nominatim.openstreetmap.org'
+        url = self.get_site_option('nominatim_url') or 'http://nominatim.entrouvert.org'
         url += '/reverse'
         reverse_zoom_level = self.get_site_option('nominatim_reverse_zoom_level') or 18
         url += '?zoom=%s' % reverse_zoom_level
@@ -957,7 +957,7 @@ class QommonPublisher(Publisher, object):
         url = self.get_site_option('geocoding_service_url')
         if url:
             return url
-        url = self.get_site_option('nominatim_url') or 'http://nominatim.openstreetmap.org'
+        url = self.get_site_option('nominatim_url') or 'http://nominatim.entrouvert.org'
         url += '/search'
         key = self.get_site_option('nominatim_key')
         if key:
-- 
2.20.1

