geobox 1.3.2__tar.gz → 1.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geobox-1.3.2 → geobox-1.3.4}/PKG-INFO +3 -1
- {geobox-1.3.2 → geobox-1.3.4}/README.md +2 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/api.py +6 -11
- {geobox-1.3.2 → geobox-1.3.4}/geobox/attachment.py +2 -3
- {geobox-1.3.2 → geobox-1.3.4}/geobox/base.py +21 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/basemap.py +6 -2
- {geobox-1.3.2 → geobox-1.3.4}/geobox/dashboard.py +1 -2
- {geobox-1.3.2 → geobox-1.3.4}/geobox/enums.py +0 -6
- {geobox-1.3.2 → geobox-1.3.4}/geobox/map.py +6 -3
- {geobox-1.3.2 → geobox-1.3.4}/geobox/model3d.py +1 -5
- {geobox-1.3.2 → geobox-1.3.4}/geobox/mosaic.py +8 -8
- {geobox-1.3.2 → geobox-1.3.4}/geobox/query.py +6 -9
- {geobox-1.3.2 → geobox-1.3.4}/geobox/raster.py +26 -14
- {geobox-1.3.2 → geobox-1.3.4}/geobox/scene.py +1 -2
- {geobox-1.3.2 → geobox-1.3.4}/geobox/tile3d.py +2 -3
- {geobox-1.3.2 → geobox-1.3.4}/geobox/tileset.py +91 -39
- {geobox-1.3.2 → geobox-1.3.4}/geobox/vectorlayer.py +10 -6
- {geobox-1.3.2 → geobox-1.3.4}/geobox/view.py +3 -3
- {geobox-1.3.2 → geobox-1.3.4}/geobox/workflow.py +1 -2
- {geobox-1.3.2 → geobox-1.3.4}/geobox.egg-info/PKG-INFO +3 -1
- {geobox-1.3.2 → geobox-1.3.4}/pyproject.toml +1 -1
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_attachment.py +1 -1
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_basemap.py +7 -2
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_map.py +12 -1
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_model3d.py +0 -4
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_mosaic.py +1 -1
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_raster.py +25 -3
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_tileset.py +54 -25
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_vectorlayer.py +8 -3
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_view.py +3 -3
- {geobox-1.3.2 → geobox-1.3.4}/LICENSE +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/__init__.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/apikey.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/exception.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/feature.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/field.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/file.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/log.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/plan.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/route.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/settings.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/task.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/usage.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/user.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/utils.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox/version.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox.egg-info/SOURCES.txt +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox.egg-info/dependency_links.txt +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox.egg-info/requires.txt +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/geobox.egg-info/top_level.txt +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/setup.cfg +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_api.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_apikey.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_dashboard.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_feature.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_field.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_file.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_log.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_plan.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_query.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_route.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_scene.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_settings.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_task.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_tile3d.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_usage.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_user.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_version.py +0 -0
- {geobox-1.3.2 → geobox-1.3.4}/tests/test_workflow.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geobox
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: SDK for Geobox's APIs
|
|
5
5
|
Author-email: Hamid Heydari <heydari.h62@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,6 +31,8 @@ Geobox® is a cloud-based GIS platform that enables users (local governments, co
|
|
|
31
31
|
|
|
32
32
|
Geobox python SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
|
|
33
33
|
|
|
34
|
+
[Here](https://geobox.readthedocs.io) you can find the official documentation for Geobox Python SDK.
|
|
35
|
+
|
|
34
36
|
Installation
|
|
35
37
|
============
|
|
36
38
|
|
|
@@ -5,6 +5,8 @@ Geobox® is a cloud-based GIS platform that enables users (local governments, co
|
|
|
5
5
|
|
|
6
6
|
Geobox python SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
|
|
7
7
|
|
|
8
|
+
[Here](https://geobox.readthedocs.io) you can find the official documentation for Geobox Python SDK.
|
|
9
|
+
|
|
8
10
|
Installation
|
|
9
11
|
============
|
|
10
12
|
|
|
@@ -781,16 +781,14 @@ class GeoboxClient:
|
|
|
781
781
|
return VectorLayerView.get_view_by_name(self, name, user_id)
|
|
782
782
|
|
|
783
783
|
|
|
784
|
-
def create_tileset(self, name: str, layers: List[
|
|
784
|
+
def create_tileset(self, name: str, layers: List[Union['VectorLayer', 'VectorLayerView']], display_name: str = None, description: str = None,
|
|
785
785
|
min_zoom: int = None, max_zoom: int = None, user_id: int = None) -> 'Tileset':
|
|
786
786
|
"""
|
|
787
787
|
Create a new tileset.
|
|
788
788
|
|
|
789
789
|
Args:
|
|
790
790
|
name (str): The name of the tileset.
|
|
791
|
-
layers (List[
|
|
792
|
-
- layer_type: The type of the layer. valid values are "vector" and "view".
|
|
793
|
-
- layer_uuid: The uuid of the layer.
|
|
791
|
+
layers (List['VectorLayer' | 'VectorLayerView']): list of vectorlayer and view objects to add to tileset.
|
|
794
792
|
display_name (str, optional): The display name of the tileset.
|
|
795
793
|
description (str, optional): The description of the tileset.
|
|
796
794
|
min_zoom (int, optional): The minimum zoom level of the tileset.
|
|
@@ -802,19 +800,16 @@ class GeoboxClient:
|
|
|
802
800
|
|
|
803
801
|
Example:
|
|
804
802
|
>>> from geobox import GeoboxClient
|
|
803
|
+
>>> from geobox.tileset import Tileset
|
|
805
804
|
>>> client = GeoboxClient()
|
|
806
|
-
>>>
|
|
807
|
-
|
|
808
|
-
... "layer_type": "vector",
|
|
809
|
-
... "layer_uuid": "12345678-1234-5678-1234-567812345678"
|
|
810
|
-
... }
|
|
811
|
-
... ]
|
|
805
|
+
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
806
|
+
>>> view = client.get_view(uuid="12345678-1234-5678-1234-567812345678")
|
|
812
807
|
>>> tileset = client.create_tileset(name="your_tileset_name",
|
|
813
808
|
... display_name="Your Tileset",
|
|
814
809
|
... description="Your description",
|
|
815
810
|
... min_zoom=0,
|
|
816
811
|
... max_zoom=14,
|
|
817
|
-
... layers=
|
|
812
|
+
... layers=[layer, view])
|
|
818
813
|
"""
|
|
819
814
|
return Tileset.create_tileset(api=self,
|
|
820
815
|
name=name,
|
|
@@ -31,7 +31,7 @@ class Attachment(Base):
|
|
|
31
31
|
"""
|
|
32
32
|
super().__init__(api, data=data)
|
|
33
33
|
self.attachment_id = attachment_id
|
|
34
|
-
self.endpoint =
|
|
34
|
+
self.endpoint = f"{self.BASE_ENDPOINT}{str(self.attachment_id)}/"
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def __repr__(self) -> str:
|
|
@@ -293,6 +293,5 @@ class Attachment(Base):
|
|
|
293
293
|
>>> attachment.thumbnail
|
|
294
294
|
'https://example.com/thumbnail.png'
|
|
295
295
|
"""
|
|
296
|
-
|
|
297
|
-
return endpoint
|
|
296
|
+
return super().thumbnail(format='')
|
|
298
297
|
|
|
@@ -362,3 +362,24 @@ class Base:
|
|
|
362
362
|
|
|
363
363
|
# If all parsing fails, return the original string
|
|
364
364
|
return date_string
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def thumbnail(self, format='.png') -> str:
|
|
368
|
+
"""
|
|
369
|
+
Get the thumbnail URL of the resource.
|
|
370
|
+
|
|
371
|
+
Returns:
|
|
372
|
+
str: The thumbnail URL
|
|
373
|
+
|
|
374
|
+
Raises:
|
|
375
|
+
ValueError:
|
|
376
|
+
"""
|
|
377
|
+
endpoint = f'{self.api.base_url}{self.endpoint}thumbnail{format}'
|
|
378
|
+
|
|
379
|
+
if not self.api.access_token and self.api.apikey:
|
|
380
|
+
endpoint = f'{endpoint}?apikey={self.api.apikey}'
|
|
381
|
+
|
|
382
|
+
elif not self.api.access_token and not self.api.apikey:
|
|
383
|
+
raise ValueError("either access_token or apikey must be available for this action.")
|
|
384
|
+
|
|
385
|
+
return endpoint
|
|
@@ -23,7 +23,7 @@ class Basemap(Base):
|
|
|
23
23
|
data (Dict): The data of the basemap.
|
|
24
24
|
"""
|
|
25
25
|
super().__init__(api, data=data)
|
|
26
|
-
self.endpoint = f"{self.BASE_ENDPOINT}{self.data.get('name')}"
|
|
26
|
+
self.endpoint = f"{self.BASE_ENDPOINT}{self.data.get('name')}/"
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
@classmethod
|
|
@@ -107,7 +107,11 @@ class Basemap(Base):
|
|
|
107
107
|
Returns:
|
|
108
108
|
str: the wmts url
|
|
109
109
|
"""
|
|
110
|
-
endpoint =
|
|
110
|
+
endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
|
|
111
|
+
|
|
112
|
+
if not self.api.access_token and self.api.apikey:
|
|
113
|
+
endpoint = f"{endpoint}?apikey={self.api.apikey}"
|
|
114
|
+
|
|
111
115
|
return endpoint
|
|
112
116
|
|
|
113
117
|
|
|
@@ -243,8 +243,7 @@ class Dashboard(Base):
|
|
|
243
243
|
>>> dashboard.thumbnail
|
|
244
244
|
'https://example.com/thumbnail.png'
|
|
245
245
|
"""
|
|
246
|
-
|
|
247
|
-
return endpoint
|
|
246
|
+
return super().thumbnail()
|
|
248
247
|
|
|
249
248
|
|
|
250
249
|
def share(self, users: List['User']) -> None:
|
|
@@ -2,7 +2,7 @@ from typing import Dict, List, Optional, Union, TYPE_CHECKING
|
|
|
2
2
|
from urllib.parse import urljoin, urlencode
|
|
3
3
|
|
|
4
4
|
from .base import Base
|
|
5
|
-
from .utils import clean_data
|
|
5
|
+
from .utils import clean_data, join_url_params
|
|
6
6
|
from .model3d import Model
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
@@ -276,8 +276,7 @@ class Map(Base):
|
|
|
276
276
|
>>> map.thumbnail
|
|
277
277
|
'https://example.com/thumbnail.png'
|
|
278
278
|
"""
|
|
279
|
-
|
|
280
|
-
return endpoint
|
|
279
|
+
return super().thumbnail()
|
|
281
280
|
|
|
282
281
|
|
|
283
282
|
def set_readonly(self, readonly: bool) -> None:
|
|
@@ -351,6 +350,10 @@ class Map(Base):
|
|
|
351
350
|
endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
|
|
352
351
|
if scale:
|
|
353
352
|
endpoint = f"{endpoint}?scale={scale}"
|
|
353
|
+
|
|
354
|
+
if not self.api.access_token and self.api.apikey:
|
|
355
|
+
endpoint = join_url_params(endpoint, {"apikey": self.api.apikey})
|
|
356
|
+
|
|
354
357
|
return endpoint
|
|
355
358
|
|
|
356
359
|
|
|
@@ -258,11 +258,7 @@ class Model(Base):
|
|
|
258
258
|
>>> model = Model.get_model(api=client, uuid="12345678-1234-5678-1234-567812345678")
|
|
259
259
|
>>> model.thumbnail
|
|
260
260
|
"""
|
|
261
|
-
|
|
262
|
-
raise ValueError("Model UUID is required.")
|
|
263
|
-
|
|
264
|
-
endpoint = urljoin(self.api.base_url, f'{self.endpoint}/thumbnail.png')
|
|
265
|
-
return endpoint
|
|
261
|
+
return super().thumbnail()
|
|
266
262
|
|
|
267
263
|
|
|
268
264
|
def share(self, users: List['User']) -> None:
|
|
@@ -295,14 +295,14 @@ class Mosaic(Raster):
|
|
|
295
295
|
return super().get_point(lat, lng)
|
|
296
296
|
|
|
297
297
|
|
|
298
|
-
def get_render_png_url(self, x: int, y: int, z: int, **kwargs) -> str:
|
|
298
|
+
def get_render_png_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}', **kwargs) -> str:
|
|
299
299
|
"""
|
|
300
300
|
Get the tile render URL of the mosaic.
|
|
301
301
|
|
|
302
302
|
Args:
|
|
303
|
-
x (int): The x coordinate of the tile.
|
|
304
|
-
y (int): The y coordinate of the tile.
|
|
305
|
-
z (int): The zoom level of the tile.
|
|
303
|
+
x (int, optional): The x coordinate of the tile.
|
|
304
|
+
y (int, optional): The y coordinate of the tile.
|
|
305
|
+
z (int, optional): The zoom level of the tile.
|
|
306
306
|
|
|
307
307
|
Keyword Args:
|
|
308
308
|
indexes (str, optional): list of comma separated band indexes to be rendered. e.g. 1, 2, 3
|
|
@@ -326,14 +326,14 @@ class Mosaic(Raster):
|
|
|
326
326
|
return super().get_render_png_url(x, y, z, **kwargs)
|
|
327
327
|
|
|
328
328
|
|
|
329
|
-
def get_tile_png_url(self, x: int, y: int, z: int) -> str:
|
|
329
|
+
def get_tile_png_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}') -> str:
|
|
330
330
|
"""
|
|
331
331
|
Get the tile PNG URL of the mosaic.
|
|
332
332
|
|
|
333
333
|
Args:
|
|
334
|
-
x (int): The x coordinate of the tile.
|
|
335
|
-
y (int): The y coordinate of the tile.
|
|
336
|
-
z (int): The zoom level of the tile.
|
|
334
|
+
x (int, optional): The x coordinate of the tile.
|
|
335
|
+
y (int, optional): The y coordinate of the tile.
|
|
336
|
+
z (int, optional): The zoom level of the tile.
|
|
337
337
|
|
|
338
338
|
Returns:
|
|
339
339
|
str: The tile PNG URL of the mosaic.
|
|
@@ -620,22 +620,19 @@ class Query(Base):
|
|
|
620
620
|
str: The thumbnail URL.
|
|
621
621
|
"""
|
|
622
622
|
self._check_access()
|
|
623
|
-
|
|
624
|
-
return endpoint
|
|
623
|
+
return super().thumbnail()
|
|
625
624
|
|
|
626
625
|
|
|
627
|
-
def save_as_layer(self, layer_name: str, layer_type: 'QueryGeometryType') ->
|
|
626
|
+
def save_as_layer(self, layer_name: str, layer_type: 'QueryGeometryType' = None) -> Task:
|
|
628
627
|
"""
|
|
629
628
|
Saves the query as a new layer.
|
|
630
629
|
|
|
631
630
|
Args:
|
|
632
|
-
sql (str): The SQL statement for the query.
|
|
633
|
-
params (list): The parameters for the SQL statement.
|
|
634
631
|
layer_name (str): The name of the new layer.
|
|
635
|
-
layer_type (QueryGeometryType): The type of the new layer.
|
|
632
|
+
layer_type (QueryGeometryType, optional): The type of the new layer.
|
|
636
633
|
|
|
637
634
|
Returns:
|
|
638
|
-
|
|
635
|
+
Task: The response task object.
|
|
639
636
|
|
|
640
637
|
Raises:
|
|
641
638
|
PermissionError: If the query is a read-only system query.
|
|
@@ -645,7 +642,7 @@ class Query(Base):
|
|
|
645
642
|
>>> from geobox.query import Query
|
|
646
643
|
>>> client = GeoboxClient()
|
|
647
644
|
>>> query = Query.get_query(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
648
|
-
>>> query.save_as_layer(layer_name='test'
|
|
645
|
+
>>> query.save_as_layer(layer_name='test')
|
|
649
646
|
"""
|
|
650
647
|
self._check_access()
|
|
651
648
|
|
|
@@ -659,7 +656,7 @@ class Query(Base):
|
|
|
659
656
|
"sql": self.sql,
|
|
660
657
|
"params": params,
|
|
661
658
|
"layer_name": layer_name,
|
|
662
|
-
"layer_type": layer_type.value
|
|
659
|
+
"layer_type": layer_type.value if layer_type else None
|
|
663
660
|
})
|
|
664
661
|
|
|
665
662
|
endpoint = urljoin(self.BASE_ENDPOINT, 'saveAsLayer/')
|
|
@@ -6,7 +6,7 @@ import requests
|
|
|
6
6
|
import sys
|
|
7
7
|
|
|
8
8
|
from .base import Base
|
|
9
|
-
from .utils import clean_data
|
|
9
|
+
from .utils import clean_data, join_url_params
|
|
10
10
|
from .task import Task
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
@@ -231,8 +231,7 @@ class Raster(Base):
|
|
|
231
231
|
>>> raster = Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
232
232
|
>>> raster.thumbnail
|
|
233
233
|
"""
|
|
234
|
-
|
|
235
|
-
return endpoint
|
|
234
|
+
return super().thumbnail(format='')
|
|
236
235
|
|
|
237
236
|
|
|
238
237
|
@property
|
|
@@ -511,19 +510,20 @@ class Raster(Base):
|
|
|
511
510
|
'colormap': kwargs.get('colormap')
|
|
512
511
|
})
|
|
513
512
|
query_string = urlencode(params)
|
|
514
|
-
endpoint =
|
|
515
|
-
|
|
513
|
+
endpoint = f'{self.api.base_url}{self.endpoint}render/{z}/{x}/{y}.png'
|
|
514
|
+
if query_string:
|
|
515
|
+
endpoint = f'{endpoint}?{query_string}'
|
|
516
516
|
return endpoint
|
|
517
517
|
|
|
518
518
|
|
|
519
|
-
def get_tile_pbf_url(self, x: int, y: int, z: int, indexes: str = None) -> str:
|
|
519
|
+
def get_tile_pbf_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}', indexes: str = None) -> str:
|
|
520
520
|
"""
|
|
521
521
|
Get the URL of the tile.
|
|
522
522
|
|
|
523
523
|
Args:
|
|
524
|
-
x (int): The x coordinate of the tile.
|
|
525
|
-
y (int): The y coordinate of the tile.
|
|
526
|
-
z (int): The zoom level of the tile.
|
|
524
|
+
x (int, optional): The x coordinate of the tile.
|
|
525
|
+
y (int, optional): The y coordinate of the tile.
|
|
526
|
+
z (int, optional): The zoom level of the tile.
|
|
527
527
|
indexes (str, optional): list of comma separated band indexes to be rendered. e.g. 1, 2, 3
|
|
528
528
|
|
|
529
529
|
Returns:
|
|
@@ -542,17 +542,21 @@ class Raster(Base):
|
|
|
542
542
|
query_string = urlencode(params)
|
|
543
543
|
endpoint = urljoin(self.api.base_url, f'{self.endpoint}tiles/{z}/{x}/{y}.pbf')
|
|
544
544
|
endpoint = urljoin(endpoint, f'?{query_string}')
|
|
545
|
+
|
|
546
|
+
if not self.api.access_token and self.api.apikey:
|
|
547
|
+
endpoint = join_url_params(endpoint, {"apikey": self.api.apikey})
|
|
548
|
+
|
|
545
549
|
return endpoint
|
|
546
550
|
|
|
547
551
|
|
|
548
|
-
def get_tile_png_url(self, x: int, y: int, z: int) -> str:
|
|
552
|
+
def get_tile_png_url(self, x: int = 'x', y: int = 'y', z: int = 'z') -> str:
|
|
549
553
|
"""
|
|
550
554
|
Get the URL of the tile.
|
|
551
555
|
|
|
552
556
|
Args:
|
|
553
|
-
x (int): The x coordinate of the tile.
|
|
554
|
-
y (int): The y coordinate of the tile.
|
|
555
|
-
z (int): The zoom level of the tile.
|
|
557
|
+
x (int, optional): The x coordinate of the tile.
|
|
558
|
+
y (int, optional): The y coordinate of the tile.
|
|
559
|
+
z (int, optional): The zoom level of the tile.
|
|
556
560
|
|
|
557
561
|
Returns:
|
|
558
562
|
str: The URL of the tile.
|
|
@@ -564,7 +568,11 @@ class Raster(Base):
|
|
|
564
568
|
>>> raster = Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
565
569
|
>>> raster.get_tile_png_url(x=10, y=20, z=1)
|
|
566
570
|
"""
|
|
567
|
-
endpoint =
|
|
571
|
+
endpoint = f'{self.api.base_url}{self.endpoint}tiles/{z}/{x}/{y}.png'
|
|
572
|
+
|
|
573
|
+
if not self.api.access_token and self.api.apikey:
|
|
574
|
+
endpoint = f'{endpoint}?apikey={self.api.apikey}'
|
|
575
|
+
|
|
568
576
|
return endpoint
|
|
569
577
|
|
|
570
578
|
|
|
@@ -606,6 +614,10 @@ class Raster(Base):
|
|
|
606
614
|
endpoint = urljoin(self.api.base_url, f'{self.endpoint}wmts/')
|
|
607
615
|
if scale:
|
|
608
616
|
endpoint = f"{endpoint}?scale={scale}"
|
|
617
|
+
|
|
618
|
+
if not self.api.access_token and self.api.apikey:
|
|
619
|
+
endpoint = join_url_params(endpoint, {"apikey": self.api.apikey})
|
|
620
|
+
|
|
609
621
|
return endpoint
|
|
610
622
|
|
|
611
623
|
|
|
@@ -244,8 +244,7 @@ class Scene(Base):
|
|
|
244
244
|
>>> scene.thumbnail
|
|
245
245
|
'https://example.com/thumbnail.png'
|
|
246
246
|
"""
|
|
247
|
-
|
|
248
|
-
return endpoint
|
|
247
|
+
return super().thumbnail()
|
|
249
248
|
|
|
250
249
|
|
|
251
250
|
def share(self, users: List['User']) -> None:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
|
2
|
-
from urllib.parse import urljoin
|
|
3
2
|
|
|
4
3
|
from .base import Base
|
|
5
4
|
|
|
6
5
|
if TYPE_CHECKING:
|
|
7
6
|
from . import GeoboxClient
|
|
7
|
+
from .user import User
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Tile3d(Base):
|
|
@@ -199,8 +199,7 @@ class Tile3d(Base):
|
|
|
199
199
|
>>> tile.thumbnail
|
|
200
200
|
'https://example.com/thumbnail.png'
|
|
201
201
|
"""
|
|
202
|
-
|
|
203
|
-
return endpoint
|
|
202
|
+
return super().thumbnail()
|
|
204
203
|
|
|
205
204
|
|
|
206
205
|
def get_item(self, path: str) -> Dict:
|