Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default tile server #426

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
)