Merge pull request #426 from SamR1/update-default-tile-server

Update default tile server
This commit is contained in:
Sam 2023-09-14 10:55:56 +02:00 committed by GitHub
commit d869ece2be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 23 deletions

View File

@ -190,7 +190,7 @@ deployment method.
| Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__. | Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__.
| Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__) | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``
.. envvar:: STATICMAP_SUBDOMAINS .. envvar:: STATICMAP_SUBDOMAINS

View File

@ -523,7 +523,7 @@ see <a class="reference external" href="https://docs.sqlalchemy.org/en/13/core/p
</div> </div>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Default<span class="colon">:</span></dt> <dt class="field-odd">Default<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png</span></code></p> <dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">https://tile.openstreetmap.org/{z}/{x}/{y}.png</span></code></p>
</dd> </dd>
</dl> </dl>
</dd></dl> </dd></dl>

View File

@ -190,7 +190,7 @@ deployment method.
| Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__. | Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__.
| Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__) | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``
.. envvar:: STATICMAP_SUBDOMAINS .. envvar:: STATICMAP_SUBDOMAINS

View File

@ -516,7 +516,7 @@
</div> </div>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">défaut<span class="colon">:</span></dt> <dt class="field-odd">défaut<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png</span></code></p> <dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">https://tile.openstreetmap.org/{z}/{x}/{y}.png</span></code></p>
</dd> </dd>
</dl> </dl>
</dd></dl> </dd></dl>

View File

@ -4413,7 +4413,7 @@ msgid "Since **0.4.9**, it's also used to generate static maps (to keep default
msgstr "" msgstr ""
#: ../source/installation.rst:193 #: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr "" msgstr ""
#: ../source/installation.rst:200 #: ../source/installation.rst:200

View File

@ -4582,7 +4582,7 @@ msgid ""
msgstr "" msgstr ""
#: ../source/installation.rst:193 #: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr "" msgstr ""
#: ../source/installation.rst:200 #: ../source/installation.rst:200

View File

@ -5017,7 +5017,7 @@ msgstr ""
"`DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)" "`DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)"
#: ../source/installation.rst:193 #: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr "" msgstr ""
#: ../source/installation.rst:200 #: ../source/installation.rst:200

View File

@ -190,7 +190,7 @@ deployment method.
| Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__. | Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__.
| Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__) | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``
.. envvar:: STATICMAP_SUBDOMAINS .. envvar:: STATICMAP_SUBDOMAINS

View File

@ -41,7 +41,7 @@ class BaseConfig:
TILE_SERVER = { TILE_SERVER = {
'URL': os.environ.get( 'URL': os.environ.get(
'TILE_SERVER_URL', 'TILE_SERVER_URL',
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
), ),
'ATTRIBUTION': os.environ.get( 'ATTRIBUTION': os.environ.get(
'MAP_ATTRIBUTION', 'MAP_ATTRIBUTION',

View File

@ -11,16 +11,7 @@ class TestGetStaticMapTileServerUrl:
'input_tile_server_subdomains,' 'input_tile_server_subdomains,'
'expected_tile_server_url', 'expected_tile_server_url',
[ [
( # tile server without subdomain
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'',
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'a',
'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
),
( (
'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
'', '',
@ -31,6 +22,21 @@ class TestGetStaticMapTileServerUrl:
'a', 'a',
'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
), ),
# tile server with subdomain
(
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png',
'a',
'https://a.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png',
),
(
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png',
'',
'https://tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png',
),
], ],
) )
def test_it_returns_tile_server_url( def test_it_returns_tile_server_url(
@ -52,12 +58,15 @@ class TestGetStaticMapTileServerUrl:
def test_it_returns_tile_server_url_with_random_subdomain(self) -> None: def test_it_returns_tile_server_url_with_random_subdomain(self) -> None:
"""in case multiple subdomains are provided""" """in case multiple subdomains are provided"""
tile_config = { tile_config = {
'URL': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'URL': (
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png'
),
'STATICMAP_SUBDOMAINS': 'a,b,c', 'STATICMAP_SUBDOMAINS': 'a,b,c',
} }
with patch('random.choice', return_value='b'): with patch('random.choice', return_value='b'):
assert ( assert get_static_map_tile_server_url(tile_config) == (
get_static_map_tile_server_url(tile_config) 'https://b.tile-cyclosm.openstreetmap.fr/cyclosm/'
== 'https://b.tile.openstreetmap.org/{z}/{x}/{y}.png' '{z}/{x}/{y}.png'
) )