Skip to content

Commit

Permalink
Merge pull request #426 from SamR1/update-default-tile-server
Browse files Browse the repository at this point in the history
Update default tile server
  • Loading branch information
SamR1 authored Sep 14, 2023
2 parents 3fb444f + abedd03 commit d869ece
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/en/_sources/installation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ deployment method.
| 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>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
:default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``


.. envvar:: STATICMAP_SUBDOMAINS
Expand Down
2 changes: 1 addition & 1 deletion docs/en/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ <h2>Environment variables<a class="headerlink" href="#environment-variables" tit
</div>
<dl class="field-list simple">
<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>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/_sources/installation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ deployment method.
| 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>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
:default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``


.. envvar:: STATICMAP_SUBDOMAINS
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ <h2>Variables d’environnement<a class="headerlink" href="#environment-variable
</div>
<dl class="field-list simple">
<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>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion docsrc/gettext/docs.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4413,7 +4413,7 @@ msgid "Since **0.4.9**, it's also used to generate static maps (to keep default
msgstr ""

#: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr ""

#: ../source/installation.rst:200
Expand Down
2 changes: 1 addition & 1 deletion docsrc/locales/en/LC_MESSAGES/docs.po
Original file line number Diff line number Diff line change
Expand Up @@ -4582,7 +4582,7 @@ msgid ""
msgstr ""

#: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr ""

#: ../source/installation.rst:200
Expand Down
2 changes: 1 addition & 1 deletion docsrc/locales/fr/LC_MESSAGES/docs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5017,7 +5017,7 @@ msgstr ""
"`DEFAULT_STATICMAP <installation.html#envvar-DEFAULT_STATICMAP>`__)"

#: ../source/installation.rst:193
msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``"
msgstr ""

#: ../source/installation.rst:200
Expand Down
2 changes: 1 addition & 1 deletion docsrc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ deployment method.
| 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>`__)
:default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
:default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png``


.. envvar:: STATICMAP_SUBDOMAINS
Expand Down
2 changes: 1 addition & 1 deletion fittrackee/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BaseConfig:
TILE_SERVER = {
'URL': os.environ.get(
'TILE_SERVER_URL',
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
'ATTRIBUTION': os.environ.get(
'MAP_ATTRIBUTION',
Expand Down
35 changes: 22 additions & 13 deletions fittrackee/tests/workouts/test_utils/test_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,31 @@ class TestGetStaticMapTileServerUrl:
'input_tile_server_subdomains,'
'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://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',
'',
'a',
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
# tile server with subdomain
(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png',
'a',
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
'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',
),
],
)
Expand All @@ -52,12 +58,15 @@ def test_it_returns_tile_server_url(
def test_it_returns_tile_server_url_with_random_subdomain(self) -> None:
"""in case multiple subdomains are provided"""
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',
}

with patch('random.choice', return_value='b'):
assert (
get_static_map_tile_server_url(tile_config)
== 'https://b.tile.openstreetmap.org/{z}/{x}/{y}.png'
assert get_static_map_tile_server_url(tile_config) == (
'https://b.tile-cyclosm.openstreetmap.fr/cyclosm/'
'{z}/{x}/{y}.png'
)

0 comments on commit d869ece

Please sign in to comment.