geobox 2.1.0__py3-none-any.whl → 2.2.1__py3-none-any.whl
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/__init__.py +61 -63
- geobox/aio/__init__.py +61 -63
- geobox/aio/api.py +491 -574
- geobox/aio/apikey.py +263 -263
- geobox/aio/attachment.py +341 -339
- geobox/aio/base.py +261 -262
- geobox/aio/basemap.py +196 -196
- geobox/aio/dashboard.py +340 -342
- geobox/aio/feature.py +35 -35
- geobox/aio/field.py +315 -321
- geobox/aio/file.py +72 -72
- geobox/aio/layout.py +340 -341
- geobox/aio/log.py +23 -23
- geobox/aio/map.py +1033 -1034
- geobox/aio/model3d.py +415 -415
- geobox/aio/mosaic.py +696 -696
- geobox/aio/plan.py +314 -314
- geobox/aio/query.py +693 -693
- geobox/aio/raster.py +88 -454
- geobox/aio/{analysis.py → raster_analysis.py} +153 -170
- geobox/aio/route.py +4 -4
- geobox/aio/scene.py +340 -342
- geobox/aio/settings.py +18 -18
- geobox/aio/task.py +404 -402
- geobox/aio/tile3d.py +337 -339
- geobox/aio/tileset.py +102 -103
- geobox/aio/usage.py +52 -51
- geobox/aio/user.py +506 -507
- geobox/aio/vector_tool.py +1968 -0
- geobox/aio/vectorlayer.py +316 -414
- geobox/aio/version.py +272 -273
- geobox/aio/view.py +1019 -983
- geobox/aio/workflow.py +340 -341
- geobox/api.py +14 -98
- geobox/apikey.py +262 -262
- geobox/attachment.py +336 -337
- geobox/base.py +384 -384
- geobox/basemap.py +194 -194
- geobox/dashboard.py +339 -341
- geobox/enums.py +31 -1
- geobox/feature.py +31 -10
- geobox/field.py +320 -320
- geobox/file.py +4 -4
- geobox/layout.py +339 -340
- geobox/log.py +4 -4
- geobox/map.py +1031 -1032
- geobox/model3d.py +410 -410
- geobox/mosaic.py +696 -696
- geobox/plan.py +313 -313
- geobox/query.py +691 -691
- geobox/raster.py +5 -368
- geobox/{analysis.py → raster_analysis.py} +108 -128
- geobox/scene.py +341 -342
- geobox/settings.py +194 -194
- geobox/task.py +399 -400
- geobox/tile3d.py +337 -338
- geobox/tileset.py +4 -4
- geobox/usage.py +3 -3
- geobox/user.py +503 -503
- geobox/vector_tool.py +1968 -0
- geobox/vectorlayer.py +5 -110
- geobox/version.py +272 -272
- geobox/view.py +981 -981
- geobox/workflow.py +338 -339
- {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/METADATA +15 -1
- geobox-2.2.1.dist-info/RECORD +72 -0
- geobox-2.1.0.dist-info/RECORD +0 -70
- {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/WHEEL +0 -0
- {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/licenses/LICENSE +0 -0
- {geobox-2.1.0.dist-info → geobox-2.2.1.dist-info}/top_level.txt +0 -0
geobox/aio/tileset.py
CHANGED
|
@@ -2,24 +2,24 @@ from urllib.parse import urljoin
|
|
|
2
2
|
from typing import Dict, List, Optional, Union, TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from .base import AsyncBase
|
|
5
|
-
from .vectorlayer import
|
|
6
|
-
from .view import
|
|
7
|
-
from .task import
|
|
5
|
+
from .vectorlayer import AsyncVectorLayer
|
|
6
|
+
from .view import AsyncVectorLayerView
|
|
7
|
+
from .task import AsyncTask
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from . import AsyncGeoboxClient
|
|
11
|
-
from .user import
|
|
12
|
-
from ..api import GeoboxClient
|
|
13
|
-
from ..tileset import Tileset
|
|
11
|
+
from .user import AsyncUser
|
|
12
|
+
from ..api import GeoboxClient
|
|
13
|
+
from ..tileset import Tileset
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class AsyncTileset(AsyncBase):
|
|
16
16
|
|
|
17
17
|
BASE_ENDPOINT: str = 'tilesets/'
|
|
18
18
|
|
|
19
19
|
def __init__(self,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
api: 'AsyncGeoboxClient',
|
|
21
|
+
uuid: str,
|
|
22
|
+
data: Optional[Dict] = {}):
|
|
23
23
|
"""
|
|
24
24
|
Constructs all the necessary attributes for the Tilesets object.
|
|
25
25
|
|
|
@@ -32,8 +32,15 @@ class Tileset(AsyncBase):
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
@classmethod
|
|
35
|
-
async def create_tileset(cls,
|
|
36
|
-
|
|
35
|
+
async def create_tileset(cls,
|
|
36
|
+
api: 'AsyncGeoboxClient',
|
|
37
|
+
name: str,
|
|
38
|
+
layers: List[Union['AsyncVectorLayer', 'AsyncVectorLayerView']],
|
|
39
|
+
display_name: str = None,
|
|
40
|
+
description: str = None,
|
|
41
|
+
min_zoom: int = None,
|
|
42
|
+
max_zoom: int = None,
|
|
43
|
+
user_id: int = None) -> 'AsyncTileset':
|
|
37
44
|
"""
|
|
38
45
|
[async] Create a new tileset.
|
|
39
46
|
|
|
@@ -48,15 +55,15 @@ class Tileset(AsyncBase):
|
|
|
48
55
|
user_id (int, optional): Specific user. privileges required.
|
|
49
56
|
|
|
50
57
|
Returns:
|
|
51
|
-
|
|
58
|
+
AsyncTileset: The created tileset instance.
|
|
52
59
|
|
|
53
60
|
Example:
|
|
54
61
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
55
|
-
>>> from geobox.aio.tileset import
|
|
62
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
56
63
|
>>> async with AsyncGeoboxClient() as client:
|
|
57
64
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
58
65
|
>>> view = await client.get_view(uuid="12345678-1234-5678-1234-567812345678")
|
|
59
|
-
>>> tileset = await
|
|
66
|
+
>>> tileset = await AsyncTileset.create_tileset(client,
|
|
60
67
|
... name="your_tileset_name",
|
|
61
68
|
... display_name="Your Tileset",
|
|
62
69
|
... description="Your description",
|
|
@@ -73,10 +80,10 @@ class Tileset(AsyncBase):
|
|
|
73
80
|
"""
|
|
74
81
|
formatted_layers = []
|
|
75
82
|
for item in layers:
|
|
76
|
-
if type(item) ==
|
|
83
|
+
if type(item) == AsyncVectorLayer:
|
|
77
84
|
item_type = 'vector'
|
|
78
85
|
|
|
79
|
-
elif type(item) ==
|
|
86
|
+
elif type(item) == AsyncVectorLayerView:
|
|
80
87
|
item_type = 'view'
|
|
81
88
|
|
|
82
89
|
else:
|
|
@@ -96,11 +103,11 @@ class Tileset(AsyncBase):
|
|
|
96
103
|
"layers": formatted_layers,
|
|
97
104
|
"user_id": user_id
|
|
98
105
|
}
|
|
99
|
-
return await super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item:
|
|
106
|
+
return await super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: AsyncTileset(api, item['uuid'], item))
|
|
100
107
|
|
|
101
108
|
|
|
102
109
|
@classmethod
|
|
103
|
-
async def get_tilesets(cls, api: 'AsyncGeoboxClient', **kwargs) -> Union[List['
|
|
110
|
+
async def get_tilesets(cls, api: 'AsyncGeoboxClient', **kwargs) -> Union[List['AsyncTileset'], int]:
|
|
104
111
|
"""
|
|
105
112
|
[async] Retrieves a list of tilesets.
|
|
106
113
|
|
|
@@ -119,13 +126,13 @@ class Tileset(AsyncBase):
|
|
|
119
126
|
shared (bool): Whether to return shared tilesets. default is False.
|
|
120
127
|
|
|
121
128
|
Returns:
|
|
122
|
-
List[
|
|
129
|
+
List[AsyncTileset] | int: A list of Tileset instances or the total number of tilesets
|
|
123
130
|
|
|
124
131
|
Example:
|
|
125
132
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
126
|
-
>>> from geobox.aio.tileset import
|
|
133
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
127
134
|
>>> async with AsyncGeoboxClient() as client:
|
|
128
|
-
>>> tilesets = await
|
|
135
|
+
>>> tilesets = await AsyncTileset.get_tilesets(client,
|
|
129
136
|
... q="name LIKE '%your_tileset_name%'",
|
|
130
137
|
... order_by="name A",
|
|
131
138
|
... skip=0,
|
|
@@ -150,11 +157,11 @@ class Tileset(AsyncBase):
|
|
|
150
157
|
'user_id': kwargs.get('user_id', None),
|
|
151
158
|
'shared': kwargs.get('shared', False)
|
|
152
159
|
}
|
|
153
|
-
return await super()._get_list(api=api, endpoint=cls.BASE_ENDPOINT, params=params, factory_func=lambda api, item:
|
|
160
|
+
return await super()._get_list(api=api, endpoint=cls.BASE_ENDPOINT, params=params, factory_func=lambda api, item: AsyncTileset(api, item['uuid'], item))
|
|
154
161
|
|
|
155
162
|
|
|
156
163
|
@classmethod
|
|
157
|
-
async def get_tilesets_by_ids(cls, api: 'AsyncGeoboxClient', ids: List[str], user_id: int = None) -> List['
|
|
164
|
+
async def get_tilesets_by_ids(cls, api: 'AsyncGeoboxClient', ids: List[str], user_id: int = None) -> List['AsyncTileset']:
|
|
158
165
|
"""
|
|
159
166
|
[async] Retrieves a list of tilesets by their IDs.
|
|
160
167
|
|
|
@@ -164,13 +171,13 @@ class Tileset(AsyncBase):
|
|
|
164
171
|
user_id (int, optional): Specific user. privileges required.
|
|
165
172
|
|
|
166
173
|
Returns:
|
|
167
|
-
List[
|
|
174
|
+
List[AsyncTileset]: A list of Tileset instances.
|
|
168
175
|
|
|
169
176
|
Example:
|
|
170
177
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
171
|
-
>>> from geobox.aio.tileset import
|
|
178
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
172
179
|
>>> async with AsyncGeoboxClient() as client:
|
|
173
|
-
>>> tilesets = await
|
|
180
|
+
>>> tilesets = await AsyncTileset.get_tilesets_by_ids(client, ids=['123', '456'])
|
|
174
181
|
or
|
|
175
182
|
>>> tilesets = await client.get_tilesets_by_ids(ids=['123', '456'])
|
|
176
183
|
"""
|
|
@@ -178,11 +185,11 @@ class Tileset(AsyncBase):
|
|
|
178
185
|
'ids': ids,
|
|
179
186
|
'user_id': user_id
|
|
180
187
|
}
|
|
181
|
-
return await super()._get_list_by_ids(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item:
|
|
188
|
+
return await super()._get_list_by_ids(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: AsyncTileset(api, item['uuid'], item))
|
|
182
189
|
|
|
183
190
|
|
|
184
191
|
@classmethod
|
|
185
|
-
async def get_tileset(cls, api: 'AsyncGeoboxClient', uuid: str) -> '
|
|
192
|
+
async def get_tileset(cls, api: 'AsyncGeoboxClient', uuid: str) -> 'AsyncTileset':
|
|
186
193
|
"""
|
|
187
194
|
[async] Retrieves a tileset by its UUID.
|
|
188
195
|
|
|
@@ -191,21 +198,21 @@ class Tileset(AsyncBase):
|
|
|
191
198
|
uuid (str): The UUID of the tileset.
|
|
192
199
|
|
|
193
200
|
Returns:
|
|
194
|
-
|
|
201
|
+
AsyncTileset: The retrieved tileset instance.
|
|
195
202
|
|
|
196
203
|
Example:
|
|
197
204
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
198
|
-
>>> from geobox.aio.tileset import
|
|
205
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
199
206
|
>>> async with AsyncGeoboxClient() as client:
|
|
200
|
-
>>> tileset = await
|
|
207
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
201
208
|
or
|
|
202
209
|
>>> tileset = await client.get_tileset(uuid="12345678-1234-5678-1234-567812345678")
|
|
203
210
|
"""
|
|
204
|
-
return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, factory_func=lambda api, item:
|
|
211
|
+
return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, factory_func=lambda api, item: AsyncTileset(api, item['uuid'], item))
|
|
205
212
|
|
|
206
213
|
|
|
207
214
|
@classmethod
|
|
208
|
-
async def get_tileset_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> Union['
|
|
215
|
+
async def get_tileset_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> Union['AsyncTileset', None]:
|
|
209
216
|
"""
|
|
210
217
|
[async] Get a tileset by name
|
|
211
218
|
|
|
@@ -215,11 +222,11 @@ class Tileset(AsyncBase):
|
|
|
215
222
|
user_id (int, optional): specific user. privileges required.
|
|
216
223
|
|
|
217
224
|
Returns:
|
|
218
|
-
|
|
225
|
+
AsyncTileset | None: returns the tileset if a tileset matches the given name, else None
|
|
219
226
|
|
|
220
227
|
Example:
|
|
221
228
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
222
|
-
>>> from geobox.aio.tileset import
|
|
229
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
223
230
|
>>> async with AsyncGeoboxClient() as client:
|
|
224
231
|
>>> tileset = await VectorLayer.get_tileset_by_name(client, name='test')
|
|
225
232
|
or
|
|
@@ -248,9 +255,9 @@ class Tileset(AsyncBase):
|
|
|
248
255
|
|
|
249
256
|
Example:
|
|
250
257
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
251
|
-
>>> from geobox.aio.tileset import
|
|
258
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
252
259
|
>>> async with AsyncGeoboxClient() as client:
|
|
253
|
-
>>> tileset = await
|
|
260
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
254
261
|
>>> await tileset.update_tileset(
|
|
255
262
|
... name="new_name",
|
|
256
263
|
... display_name="New Display Name",
|
|
@@ -282,15 +289,15 @@ class Tileset(AsyncBase):
|
|
|
282
289
|
|
|
283
290
|
Example:
|
|
284
291
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
285
|
-
>>> from geobox.aio.tileset import
|
|
292
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
286
293
|
>>> async with AsyncGeoboxClient() as client:
|
|
287
|
-
>>> tileset = await
|
|
294
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
288
295
|
>>> await tileset.delete()
|
|
289
296
|
"""
|
|
290
|
-
await super().
|
|
297
|
+
await super()._delete(urljoin(self.BASE_ENDPOINT, f'{self.uuid}/'))
|
|
291
298
|
|
|
292
299
|
|
|
293
|
-
async def get_layers(self, **kwargs) -> List['
|
|
300
|
+
async def get_layers(self, **kwargs) -> Union[List['AsyncVectorLayer'], List['AsyncVectorLayerView']]:
|
|
294
301
|
"""
|
|
295
302
|
[async] Retrieves the layers of the tileset with optional parameters.
|
|
296
303
|
|
|
@@ -306,21 +313,13 @@ class Tileset(AsyncBase):
|
|
|
306
313
|
shared (bool): if True, returns only the layers that has been shared with you. default is False.
|
|
307
314
|
|
|
308
315
|
Returns:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
Raises:
|
|
312
|
-
ApiRequestError: If the API request fails.
|
|
313
|
-
|
|
314
|
-
Example:
|
|
315
|
-
|
|
316
|
-
Returns:
|
|
317
|
-
List: A list of VectorLayer or VectorLayerView instances.
|
|
316
|
+
AsyncVectorLayer | AsyncVectorLayerView: A list of VectorLayer or VectorLayerView instances.
|
|
318
317
|
|
|
319
318
|
Example:
|
|
320
319
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
321
|
-
>>> from geobox.aio.tileset import
|
|
320
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
322
321
|
>>> async with AsyncGeoboxClient() as client:
|
|
323
|
-
>>> tileset = await
|
|
322
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
324
323
|
>>> layers = await tileset.get_layers()
|
|
325
324
|
"""
|
|
326
325
|
params = {
|
|
@@ -336,16 +335,16 @@ class Tileset(AsyncBase):
|
|
|
336
335
|
'shared': kwargs.get('shared', False)
|
|
337
336
|
}
|
|
338
337
|
endpoint = urljoin(self.BASE_ENDPOINT, f'{self.uuid}/layers/')
|
|
339
|
-
return await super()._get_list(self.api, endpoint, params, factory_func=lambda api, item:
|
|
340
|
-
|
|
338
|
+
return await super()._get_list(self.api, endpoint, params, factory_func=lambda api, item: AsyncVectorLayer(api, item['uuid'], item['layer_type'], item) if not item['is_view'] else \
|
|
339
|
+
AsyncVectorLayerView(api, item['uuid'], item['layer_type'], item))
|
|
341
340
|
|
|
342
341
|
|
|
343
|
-
async def add_layer(self, layer: Union['
|
|
342
|
+
async def add_layer(self, layer: Union['AsyncVectorLayer', 'AsyncVectorLayerView']) -> None:
|
|
344
343
|
"""
|
|
345
344
|
[async] Adds a layer to the tileset.
|
|
346
345
|
|
|
347
346
|
Args:
|
|
348
|
-
layer (
|
|
347
|
+
layer (AsyncVectorLayer | AsyncVectorLayerView): the layer object to add to the tileset
|
|
349
348
|
|
|
350
349
|
Returns:
|
|
351
350
|
None
|
|
@@ -355,16 +354,16 @@ class Tileset(AsyncBase):
|
|
|
355
354
|
|
|
356
355
|
Example:
|
|
357
356
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
358
|
-
>>> from geobox.aio.tileset import
|
|
357
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
359
358
|
>>> async with AsyncGeoboxClient() as client:
|
|
360
|
-
>>> tileset = await
|
|
359
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
361
360
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
362
361
|
>>> await tileset.add_layer(layer)
|
|
363
362
|
"""
|
|
364
|
-
if type(layer) ==
|
|
363
|
+
if type(layer) == AsyncVectorLayer:
|
|
365
364
|
layer_type = 'vector'
|
|
366
365
|
|
|
367
|
-
elif type(layer) ==
|
|
366
|
+
elif type(layer) == AsyncVectorLayerView:
|
|
368
367
|
layer_type = 'view'
|
|
369
368
|
|
|
370
369
|
else:
|
|
@@ -379,12 +378,12 @@ class Tileset(AsyncBase):
|
|
|
379
378
|
return await self.api.post(endpoint, data, is_json=False)
|
|
380
379
|
|
|
381
380
|
|
|
382
|
-
async def delete_layer(self, layer: Union['
|
|
381
|
+
async def delete_layer(self, layer: Union['AsyncVectorLayer', 'AsyncVectorLayerView']) -> None:
|
|
383
382
|
"""
|
|
384
383
|
[async] Deletes a layer from the tileset.
|
|
385
384
|
|
|
386
385
|
Args:
|
|
387
|
-
layer (
|
|
386
|
+
layer (AsyncVectorLayer | AsyncVectorLayerView): the layer object to delete from the tileset
|
|
388
387
|
|
|
389
388
|
Returns:
|
|
390
389
|
None
|
|
@@ -394,16 +393,16 @@ class Tileset(AsyncBase):
|
|
|
394
393
|
|
|
395
394
|
Example:
|
|
396
395
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
397
|
-
>>> from geobox.aio.tileset import
|
|
396
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
398
397
|
>>> async with AsyncGeoboxClient() as client:
|
|
399
|
-
>>> tileset = await
|
|
398
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
400
399
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
401
400
|
>>> await tileset.delete_layer(layer)
|
|
402
401
|
"""
|
|
403
|
-
if type(layer) ==
|
|
402
|
+
if type(layer) == AsyncVectorLayer:
|
|
404
403
|
layer_type = 'vector'
|
|
405
404
|
|
|
406
|
-
elif type(layer) ==
|
|
405
|
+
elif type(layer) == AsyncVectorLayerView:
|
|
407
406
|
layer_type = 'view'
|
|
408
407
|
|
|
409
408
|
else:
|
|
@@ -418,49 +417,49 @@ class Tileset(AsyncBase):
|
|
|
418
417
|
return await self.api.delete(endpoint, data, is_json=False)
|
|
419
418
|
|
|
420
419
|
|
|
421
|
-
async def share(self, users: List['
|
|
420
|
+
async def share(self, users: List['AsyncUser']) -> None:
|
|
422
421
|
"""
|
|
423
422
|
[async] Shares the file with specified users.
|
|
424
423
|
|
|
425
424
|
Args:
|
|
426
|
-
users (List[
|
|
425
|
+
users (List[AsyncUser]): The list of user IDs to share the file with.
|
|
427
426
|
|
|
428
427
|
Returns:
|
|
429
428
|
None
|
|
430
429
|
|
|
431
430
|
Example:
|
|
432
431
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
433
|
-
>>> from geobox.aio.tileset import
|
|
432
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
434
433
|
>>> async with AsyncGeoboxClient() as client:
|
|
435
|
-
>>> tileset = await
|
|
434
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
436
435
|
>>> users = await client.search_usesrs(search='John')
|
|
437
436
|
>>> await tileset.share(users=users)
|
|
438
437
|
"""
|
|
439
438
|
await super()._share(self.endpoint, users)
|
|
440
439
|
|
|
441
440
|
|
|
442
|
-
async def unshare(self, users: List['
|
|
441
|
+
async def unshare(self, users: List['AsyncUser']) -> None:
|
|
443
442
|
"""
|
|
444
443
|
[async] Unshares the file with specified users.
|
|
445
444
|
|
|
446
445
|
Args:
|
|
447
|
-
users (List[
|
|
446
|
+
users (List[AsyncUser]): The list of user IDs to unshare the file with.
|
|
448
447
|
|
|
449
448
|
Returns:
|
|
450
449
|
None
|
|
451
450
|
|
|
452
451
|
Example:
|
|
453
452
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
454
|
-
>>> from geobox.aio.tileset import
|
|
453
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
455
454
|
>>> async with AsyncGeoboxClient() as client:
|
|
456
|
-
>>> tileset = await
|
|
455
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
457
456
|
>>> users = await client.search_usesrs(search='John')
|
|
458
457
|
>>> await tileset.unshare(users=users)
|
|
459
458
|
"""
|
|
460
459
|
await super()._unshare(self.endpoint, users)
|
|
461
460
|
|
|
462
461
|
|
|
463
|
-
async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['
|
|
462
|
+
async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['AsyncUser']:
|
|
464
463
|
"""
|
|
465
464
|
[async] Retrieves the list of users the file is shared with.
|
|
466
465
|
|
|
@@ -470,13 +469,13 @@ class Tileset(AsyncBase):
|
|
|
470
469
|
limit (int, optional): The maximum number of users to retrieve.
|
|
471
470
|
|
|
472
471
|
Returns:
|
|
473
|
-
List[
|
|
472
|
+
List[AsyncUser]: The list of shared users.
|
|
474
473
|
|
|
475
474
|
Example:
|
|
476
475
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
477
|
-
>>> from geobox.aio.tileset import
|
|
476
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
478
477
|
>>> async with AsyncGeoboxClient() as client:
|
|
479
|
-
>>> tileset = await
|
|
478
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
480
479
|
>>> await tileset.get_shared_users(search='John', skip=0, limit=10)
|
|
481
480
|
"""
|
|
482
481
|
params = {
|
|
@@ -496,9 +495,9 @@ class Tileset(AsyncBase):
|
|
|
496
495
|
|
|
497
496
|
Example:
|
|
498
497
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
499
|
-
>>> from geobox.aio.tileset import
|
|
498
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
500
499
|
>>> async with AsyncGeoboxClient() as client:
|
|
501
|
-
>>> tileset = await
|
|
500
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
502
501
|
>>> await tileset.get_tile_json()
|
|
503
502
|
"""
|
|
504
503
|
endpoint = urljoin(self.endpoint, 'tilejson.json/')
|
|
@@ -514,9 +513,9 @@ class Tileset(AsyncBase):
|
|
|
514
513
|
|
|
515
514
|
Example:
|
|
516
515
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
517
|
-
>>> from geobox.aio.tileset import
|
|
516
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
518
517
|
>>> async with AsyncGeoboxClient() as client:
|
|
519
|
-
>>> tileset = await
|
|
518
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
520
519
|
>>> await tileset.update_tileset_extent()
|
|
521
520
|
"""
|
|
522
521
|
endpoint = urljoin(self.endpoint, 'updateExtent/')
|
|
@@ -537,9 +536,9 @@ class Tileset(AsyncBase):
|
|
|
537
536
|
|
|
538
537
|
Example:
|
|
539
538
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
540
|
-
>>> from geobox.aio.tileset import
|
|
539
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
541
540
|
>>> async with AsyncGeoboxClient() as client:
|
|
542
|
-
>>> tileset = await
|
|
541
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
543
542
|
>>> await tileset.get_tile_tileset(x=1, y=1, z=1)
|
|
544
543
|
"""
|
|
545
544
|
endpoint = f'{self.api.base_url}{self.endpoint}tiles/{z}/{x}/{y}.pbf'
|
|
@@ -550,7 +549,7 @@ class Tileset(AsyncBase):
|
|
|
550
549
|
return endpoint
|
|
551
550
|
|
|
552
551
|
|
|
553
|
-
async def seed_cache(self, from_zoom: int = 0, to_zoom: int = 14, extent: list = [], workers: int = 1, user_id: int = 0) -> List['
|
|
552
|
+
async def seed_cache(self, from_zoom: int = 0, to_zoom: int = 14, extent: list = [], workers: int = 1, user_id: int = 0) -> List['AsyncTask']:
|
|
554
553
|
"""
|
|
555
554
|
[async] Seeds the cache of the tileset.
|
|
556
555
|
|
|
@@ -562,16 +561,16 @@ class Tileset(AsyncBase):
|
|
|
562
561
|
user_id (int, optional): The user ID.
|
|
563
562
|
|
|
564
563
|
Returns:
|
|
565
|
-
List[
|
|
564
|
+
List[AsyncTask]: list of task objects.
|
|
566
565
|
|
|
567
566
|
Raises:
|
|
568
567
|
ValueError: If the number of workers is not one of the following: 1, 2, 4, 8, 12, 16, 20, 24.
|
|
569
568
|
|
|
570
569
|
Example:
|
|
571
570
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
572
|
-
>>> from geobox.aio.tileset import
|
|
571
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
573
572
|
>>> async with AsyncGeoboxClient() as client:
|
|
574
|
-
>>> tileset = await
|
|
573
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
575
574
|
>>> await tileset.seed_cache(from_zoom=0, to_zoom=14, extent=[], workers=1)
|
|
576
575
|
"""
|
|
577
576
|
data = {
|
|
@@ -584,7 +583,7 @@ class Tileset(AsyncBase):
|
|
|
584
583
|
return await super()._seed_cache(endpoint=self.endpoint, data=data)
|
|
585
584
|
|
|
586
585
|
|
|
587
|
-
async def update_cache(self, from_zoom: int, to_zoom: int, extents: List[List[float]] = None, user_id: int = 0) -> List['
|
|
586
|
+
async def update_cache(self, from_zoom: int, to_zoom: int, extents: List[List[float]] = None, user_id: int = 0) -> List['AsyncTask']:
|
|
588
587
|
"""
|
|
589
588
|
[async] Updates the cache of the tileset.
|
|
590
589
|
|
|
@@ -599,9 +598,9 @@ class Tileset(AsyncBase):
|
|
|
599
598
|
|
|
600
599
|
Example:
|
|
601
600
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
602
|
-
>>> from geobox.aio.tileset import
|
|
601
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
603
602
|
>>> async with AsyncGeoboxClient() as client:
|
|
604
|
-
>>> tileset = await
|
|
603
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
605
604
|
>>> await tileset.update_cache(from_zoom=0, to_zoom=14, extent=[])
|
|
606
605
|
"""
|
|
607
606
|
data = {
|
|
@@ -623,9 +622,9 @@ class Tileset(AsyncBase):
|
|
|
623
622
|
|
|
624
623
|
Example:
|
|
625
624
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
626
|
-
>>> from geobox.aio.tileset import
|
|
625
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
627
626
|
>>> async with AsyncGeoboxClient() as client:
|
|
628
|
-
>>> tileset = await
|
|
627
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
629
628
|
>>> await tileset.cache_size
|
|
630
629
|
"""
|
|
631
630
|
return await super()._cache_size(endpoint=self.endpoint)
|
|
@@ -640,33 +639,33 @@ class Tileset(AsyncBase):
|
|
|
640
639
|
|
|
641
640
|
Example:
|
|
642
641
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
643
|
-
>>> from geobox.aio.tileset import
|
|
642
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
644
643
|
>>> async with AsyncGeoboxClient() as client:
|
|
645
|
-
>>> tileset = await
|
|
644
|
+
>>> tileset = await AsyncTileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
646
645
|
>>> await tileset.clear_cache()
|
|
647
646
|
"""
|
|
648
647
|
await super()._clear_cache(endpoint=self.endpoint)
|
|
649
648
|
|
|
650
649
|
|
|
651
|
-
def to_sync(self, sync_client: '
|
|
650
|
+
def to_sync(self, sync_client: 'GeoboxClient') -> 'Tileset':
|
|
652
651
|
"""
|
|
653
652
|
Switch to sync version of the tileset instance to have access to the sync methods
|
|
654
653
|
|
|
655
654
|
Args:
|
|
656
|
-
sync_client (
|
|
655
|
+
sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
|
|
657
656
|
|
|
658
657
|
Returns:
|
|
659
|
-
|
|
658
|
+
Tileset: the sync instance of the tileset.
|
|
660
659
|
|
|
661
660
|
Example:
|
|
662
661
|
>>> from geobox import Geoboxclient
|
|
663
662
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
664
|
-
>>> from geobox.aio.tileset import
|
|
663
|
+
>>> from geobox.aio.tileset import AsyncTileset
|
|
665
664
|
>>> client = GeoboxClient()
|
|
666
665
|
>>> async with AsyncGeoboxClient() as async_client:
|
|
667
|
-
>>> tileset = await
|
|
666
|
+
>>> tileset = await AsyncTileset.get_tileset(async_client, uuid="12345678-1234-5678-1234-567812345678")
|
|
668
667
|
>>> sync_tileset = tileset.to_sync(client)
|
|
669
668
|
"""
|
|
670
|
-
from ..tileset import Tileset
|
|
669
|
+
from ..tileset import Tileset
|
|
671
670
|
|
|
672
|
-
return
|
|
671
|
+
return Tileset(api=sync_client, uuid=self.uuid, data=self.data)
|