From e32953f2fe0a7d096968f1cb5624685a233fedb1 Mon Sep 17 00:00:00 2001 From: gnehcdrawoh Date: Sun, 26 Dec 2021 10:49:01 -0800 Subject: [PATCH 1/2] Add Mapbox tiles api support --- src/server.py | 4 +++- src/settings.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.py b/src/server.py index 4d3797a1..71a3e208 100644 --- a/src/server.py +++ b/src/server.py @@ -62,7 +62,9 @@ def url_mapping(server: str, tile_x: int, tile_y: int, level_of_detail: int) -> if "khm" in server: return f"https://{server}/kh/v=908?x={tile_x}&y={tile_y}&z={level_of_detail}" - + + if "mapbox" in server: + return f"https://{server}/v4/mapbox.satellite/{level_of_detail}/{tile_x}/{tile_y}.jpg?sku=101AdikDMLlCK&access_token=yourToken" @app.route("/tiles/akh") def tiles(path: str) -> Response: diff --git a/src/settings.py b/src/settings.py index f4688732..0489ea7e 100644 --- a/src/settings.py +++ b/src/settings.py @@ -23,7 +23,7 @@ def proxy_url(self, proxy_url: str) -> None: @property def google_servers(self) -> list[str]: - return ["khm.google.com", 'mt.google.com'] + return ['mt.google.com','khm.google.com',"api.mapbox.com"] @property def google_server(self): From a6e41001462e3f379ad2a451ee3b6f6db3505470 Mon Sep 17 00:00:00 2001 From: gnehcdrawoh Date: Mon, 10 Jan 2022 21:25:20 +0800 Subject: [PATCH 2/2] Add ArcGIS tiles api support --- src/server.py | 5 ++++- src/settings.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server.py b/src/server.py index 71a3e208..36f8a0b1 100644 --- a/src/server.py +++ b/src/server.py @@ -64,7 +64,10 @@ def url_mapping(server: str, tile_x: int, tile_y: int, level_of_detail: int) -> return f"https://{server}/kh/v=908?x={tile_x}&y={tile_y}&z={level_of_detail}" if "mapbox" in server: - return f"https://{server}/v4/mapbox.satellite/{level_of_detail}/{tile_x}/{tile_y}.jpg?sku=101AdikDMLlCK&access_token=yourToken" + return f"https://{server}/v4/mapbox.satellite/{level_of_detail}/{tile_x}/{tile_y}.jpg?sku=cky8e1hd40jus15nzunvf7q4u&access_token=pk.eyJ1IjoiaDB3YXJkIiwiYSI6ImNreG5td3UxajFwNW4ybnBudWtvdmw4bjEifQ.mbmam48LS8GaSWYXUOrNUQ" + + if "arcgisonline" in server: + return f"https://{server}/ArcGIS/rest/services/World_Imagery/MapServer/tile/{level_of_detail}/{tile_y}/{tile_x}" @app.route("/tiles/akh") def tiles(path: str) -> Response: diff --git a/src/settings.py b/src/settings.py index 0489ea7e..23b28200 100644 --- a/src/settings.py +++ b/src/settings.py @@ -23,7 +23,7 @@ def proxy_url(self, proxy_url: str) -> None: @property def google_servers(self) -> list[str]: - return ['mt.google.com','khm.google.com',"api.mapbox.com"] + return ['mt.google.com','khm.google.com',"api.mapbox.com","services.arcgisonline.com"] @property def google_server(self):