Skip to content

Commit be95cfe

Browse files
authored
Merge pull request #534 from mapswipe/fix-tileserver-placeholders
adjust tileserver url check and allow {-y} placeholder
2 parents 4fa93c4 + 77984b3 commit be95cfe

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

manager_dashboard/manager_dashboard/js/uploadProjects.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,18 @@ function checkImageryUrl() {
172172
// check if url A contains the placeholders when using custom imagery
173173
urlA = document.getElementById("tileServerAUrl").value
174174
nameA = document.getElementById("tileServerAName").value
175-
if (nameA === "custom" & (!urlA.includes("{x}") | !urlA.includes("{y}") | !urlA.includes("{z}"))) {
176-
alert("The imagery url A must contain {x}, {y} and {z} placeholders.")
175+
if (nameA === "custom" & (!urlA.includes("{z}") | !urlA.includes("{x}") | (!urlA.includes("{y}") & !urlA.includes("{-y}")))) {
176+
alert("The imagery url A must contain {x}, {y} (or {-y}) and {z} placeholders." + urlA)
177177
return false
178178
}
179179

180+
console.log(urlA.includes("{x}"))
181+
180182
// check if url B contains the placeholders when using custom imagery
181183
urlB = document.getElementById("tileServerBUrl").value
182184
nameB = document.getElementById("tileServerBName").value
183-
if (nameB === "custom" & (!urlB.includes("{x}") | !urlB.includes("{y}") | !urlB.includes("{z}"))) {
184-
alert("The imagery url B must contain {x}, {y} and {z} placeholders.")
185+
if (nameB === "custom" & (!urlB.includes("{z}") | !urlB.includes("{x}") | (!urlB.includes("{y}") & !urlB.includes("{-y}")))) {
186+
alert("The imagery url B must contain {x}, {y} (or {-y}) and {z} placeholders." + urlB)
185187
return false
186188
}
187189

mapswipe_workers/mapswipe_workers/project_types/base/tile_server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def __init__(self, tile_server_dict):
2121
# check if url contains the right place holders
2222
if not self.check_imagery_url():
2323
raise CustomError(
24-
f"The imagery url {self.url} must contain {{x}}, {{y}} and {{z}} or "
25-
"the {quad_key} placeholders."
24+
f"The imagery url {self.url} must contain {{x}}, {{y}} (or {{-y}}) "
25+
"and {{z}} or the {quad_key} placeholders."
2626
)
2727

2828
# set api key
@@ -47,6 +47,8 @@ def check_imagery_url(self):
4747
"""Check if imagery url contains xyz or quad key placeholders."""
4848
if all([substring in self.url for substring in ["{x}", "{y}", "{z}"]]):
4949
return True
50+
elif all([substring in self.url for substring in ["{x}", "{-y}", "{z}"]]):
51+
return True
5052
elif "{quad_key}" in self.url:
5153
return True
5254
else:

0 commit comments

Comments
 (0)