geobox 1.4.1__py3-none-any.whl → 2.0.0__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 +2 -2
- geobox/aio/__init__.py +63 -0
- geobox/aio/api.py +2640 -0
- geobox/aio/apikey.py +263 -0
- geobox/aio/attachment.py +339 -0
- geobox/aio/base.py +262 -0
- geobox/aio/basemap.py +196 -0
- geobox/aio/dashboard.py +342 -0
- geobox/aio/feature.py +527 -0
- geobox/aio/field.py +321 -0
- geobox/aio/file.py +522 -0
- geobox/aio/layout.py +341 -0
- geobox/aio/log.py +145 -0
- geobox/aio/map.py +1034 -0
- geobox/aio/model3d.py +415 -0
- geobox/aio/mosaic.py +696 -0
- geobox/aio/plan.py +315 -0
- geobox/aio/query.py +702 -0
- geobox/aio/raster.py +869 -0
- geobox/aio/route.py +63 -0
- geobox/aio/scene.py +342 -0
- geobox/aio/settings.py +194 -0
- geobox/aio/task.py +402 -0
- geobox/aio/tile3d.py +339 -0
- geobox/aio/tileset.py +672 -0
- geobox/aio/usage.py +243 -0
- geobox/aio/user.py +507 -0
- geobox/aio/vectorlayer.py +1363 -0
- geobox/aio/version.py +273 -0
- geobox/aio/view.py +983 -0
- geobox/aio/workflow.py +341 -0
- geobox/api.py +14 -13
- geobox/apikey.py +28 -1
- geobox/attachment.py +27 -1
- geobox/base.py +4 -4
- geobox/basemap.py +30 -1
- geobox/dashboard.py +27 -0
- geobox/feature.py +33 -13
- geobox/field.py +33 -21
- geobox/file.py +40 -46
- geobox/layout.py +28 -1
- geobox/log.py +31 -7
- geobox/map.py +56 -5
- geobox/model3d.py +98 -19
- geobox/mosaic.py +47 -7
- geobox/plan.py +29 -3
- geobox/query.py +41 -5
- geobox/raster.py +45 -13
- geobox/scene.py +26 -0
- geobox/settings.py +30 -1
- geobox/task.py +28 -6
- geobox/tile3d.py +27 -1
- geobox/tileset.py +26 -5
- geobox/usage.py +32 -1
- geobox/user.py +62 -6
- geobox/utils.py +34 -0
- geobox/vectorlayer.py +59 -4
- geobox/version.py +25 -1
- geobox/view.py +54 -15
- geobox/workflow.py +27 -1
- {geobox-1.4.1.dist-info → geobox-2.0.0.dist-info}/METADATA +4 -1
- geobox-2.0.0.dist-info/RECORD +68 -0
- geobox-1.4.1.dist-info/RECORD +0 -38
- {geobox-1.4.1.dist-info → geobox-2.0.0.dist-info}/WHEEL +0 -0
- {geobox-1.4.1.dist-info → geobox-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {geobox-1.4.1.dist-info → geobox-2.0.0.dist-info}/top_level.txt +0 -0
geobox/tileset.py
CHANGED
|
@@ -9,14 +9,11 @@ from .task import Task
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from . import GeoboxClient
|
|
11
11
|
from .user import User
|
|
12
|
+
from .aio import AsyncGeoboxClient
|
|
13
|
+
from .aio.tileset import Tileset as AsyncTileset
|
|
12
14
|
|
|
13
15
|
class Tileset(Base):
|
|
14
|
-
"""
|
|
15
|
-
A class to interact with tilesets in Geobox.
|
|
16
16
|
|
|
17
|
-
This class provides functionality to interact with tilesets in Geobox.
|
|
18
|
-
It supports various operations including CRUD operations on tilesets, as well as advanced operations like getting layers, and sharing tilesets.
|
|
19
|
-
"""
|
|
20
17
|
BASE_ENDPOINT: str = 'tilesets/'
|
|
21
18
|
|
|
22
19
|
def __init__(self,
|
|
@@ -635,3 +632,27 @@ class Tileset(Base):
|
|
|
635
632
|
>>> tileset.clear_cache()
|
|
636
633
|
"""
|
|
637
634
|
super()._clear_cache(endpoint=self.endpoint)
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncTileset':
|
|
638
|
+
"""
|
|
639
|
+
Switch to async version of the tileset instance to have access to the async methods
|
|
640
|
+
|
|
641
|
+
Args:
|
|
642
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
643
|
+
|
|
644
|
+
Returns:
|
|
645
|
+
geobox.aio.tileset.Tileset: the async instance of the tileset.
|
|
646
|
+
|
|
647
|
+
Example:
|
|
648
|
+
>>> from geobox import Geoboxclient
|
|
649
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
650
|
+
>>> from geobox.tileset import Tileset
|
|
651
|
+
>>> client = GeoboxClient()
|
|
652
|
+
>>> tileset = Tileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
653
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
654
|
+
>>> async_tileset = tileset.to_async(async_client)
|
|
655
|
+
"""
|
|
656
|
+
from .aio.tileset import Tileset as AsyncTileset
|
|
657
|
+
|
|
658
|
+
return AsyncTileset(api=async_client, uuid=self.uuid, data=self.data)
|
geobox/usage.py
CHANGED
|
@@ -10,6 +10,8 @@ from .enums import UsageScale, UsageParam
|
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from . import GeoboxClient
|
|
13
|
+
from .aio import AsyncGeoboxClient
|
|
14
|
+
from .aio.usage import Usage as AsyncUsage
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
class Usage(Base):
|
|
@@ -208,4 +210,33 @@ class Usage(Base):
|
|
|
208
210
|
'user_id': user_id if user_id else None
|
|
209
211
|
})
|
|
210
212
|
endpoint = f"{cls.BASE_ENDPOINT}update"
|
|
211
|
-
return api.post(endpoint, payload=data)
|
|
213
|
+
return api.post(endpoint, payload=data)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncUsage':
|
|
217
|
+
"""
|
|
218
|
+
Switch to async version of the usage instance to have access to the async methods
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
geobox.aio.usage.Usage: the async instance of the usage.
|
|
225
|
+
|
|
226
|
+
Example:
|
|
227
|
+
>>> from geobox import Geoboxclient
|
|
228
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
229
|
+
>>> from geobox.usage import Usage
|
|
230
|
+
>>> client = GeoboxClient()
|
|
231
|
+
>>> user = client.get_user()
|
|
232
|
+
>>> usage = Usage.get_api_usage(client,
|
|
233
|
+
... resource=user,
|
|
234
|
+
... scale=UsageScale.Day,
|
|
235
|
+
... param=UsageParam.Calls,
|
|
236
|
+
... days_before_now=5)
|
|
237
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
238
|
+
>>> async_usage = usage.to_async(async_client)
|
|
239
|
+
"""
|
|
240
|
+
from .aio.usage import Usage as AsyncUsage
|
|
241
|
+
|
|
242
|
+
return AsyncUsage(api=async_client, user=self.user)
|
geobox/user.py
CHANGED
|
@@ -8,6 +8,9 @@ from .plan import Plan
|
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from . import GeoboxClient
|
|
11
|
+
from .aio import AsyncGeoboxClient
|
|
12
|
+
from .aio.user import Session as AsyncSession
|
|
13
|
+
from .aio.user import User as AsyncUser
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class User(Base):
|
|
@@ -270,7 +273,7 @@ class User(Base):
|
|
|
270
273
|
>>> from geobox.user import User
|
|
271
274
|
>>> client = GeoboxClient()
|
|
272
275
|
>>> user = User.get_user(client, user_id=1)
|
|
273
|
-
>>> user.
|
|
276
|
+
>>> user.update(status=UserStatus.PENDING)
|
|
274
277
|
"""
|
|
275
278
|
data = {
|
|
276
279
|
"username": kwargs.get('username'),
|
|
@@ -337,9 +340,9 @@ class User(Base):
|
|
|
337
340
|
or
|
|
338
341
|
>>> user = client.get_user(user_id=1)
|
|
339
342
|
|
|
340
|
-
>>> user.
|
|
343
|
+
>>> user.get_sessions()
|
|
341
344
|
or
|
|
342
|
-
>>> client.
|
|
345
|
+
>>> client.get_sessions()
|
|
343
346
|
"""
|
|
344
347
|
params = clean_data({
|
|
345
348
|
'f': 'json'
|
|
@@ -370,7 +373,7 @@ class User(Base):
|
|
|
370
373
|
>>> from geobox import GeoboxClient
|
|
371
374
|
>>> from geobox.user import User
|
|
372
375
|
>>> client = GeoboxClient()
|
|
373
|
-
>>> user = client.get_user()
|
|
376
|
+
>>> user = client.get_user(user_id=1)
|
|
374
377
|
>>> user.change_password(new_password='user_new_password')
|
|
375
378
|
"""
|
|
376
379
|
data = clean_data({
|
|
@@ -382,7 +385,7 @@ class User(Base):
|
|
|
382
385
|
|
|
383
386
|
def renew_plan(self) -> None:
|
|
384
387
|
"""
|
|
385
|
-
Renew the user plan
|
|
388
|
+
Renew the user plan (privileges required)
|
|
386
389
|
|
|
387
390
|
Returns:
|
|
388
391
|
None
|
|
@@ -396,6 +399,31 @@ class User(Base):
|
|
|
396
399
|
self.api.post(endpoint)
|
|
397
400
|
|
|
398
401
|
|
|
402
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncUser':
|
|
403
|
+
"""
|
|
404
|
+
Switch to async version of the user instance to have access to the async methods
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
408
|
+
|
|
409
|
+
Returns:
|
|
410
|
+
geobox.aio.user.User: the async instance of the user.
|
|
411
|
+
|
|
412
|
+
Example:
|
|
413
|
+
>>> from geobox import Geoboxclient
|
|
414
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
415
|
+
>>> from geobox.user import User
|
|
416
|
+
>>> client = GeoboxClient()
|
|
417
|
+
>>> user = User.get_user(client) # without user_id parameter, it gets the current user
|
|
418
|
+
or
|
|
419
|
+
>>> user = client.get_user() # without user_id parameter, it gets the current user
|
|
420
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
421
|
+
>>> async_user = user.to_async(async_client)
|
|
422
|
+
"""
|
|
423
|
+
from .aio.user import User as AsyncUser
|
|
424
|
+
|
|
425
|
+
return AsyncUser(api=async_client, user_id=self.user_id, data=self.data)
|
|
426
|
+
|
|
399
427
|
|
|
400
428
|
|
|
401
429
|
class Session(Base):
|
|
@@ -445,4 +473,32 @@ class Session(Base):
|
|
|
445
473
|
'user_id': self.user.user_id,
|
|
446
474
|
'session_uuid': self.uuid
|
|
447
475
|
})
|
|
448
|
-
self.user.api.post(self.endpoint, data)
|
|
476
|
+
self.user.api.post(self.endpoint, data)
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncSession':
|
|
480
|
+
"""
|
|
481
|
+
Switch to async version of the session instance to have access to the async methods
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
geobox.aio.user.Session: the async instance of the session.
|
|
488
|
+
|
|
489
|
+
Example:
|
|
490
|
+
>>> from geobox import Geoboxclient
|
|
491
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
492
|
+
>>> from geobox.user import User
|
|
493
|
+
>>> client = GeoboxClient()
|
|
494
|
+
>>> user = User.get_user(client) # without user_id parameter, it gets the current user
|
|
495
|
+
or
|
|
496
|
+
>>> user = client.get_user() # without user_id parameter, it gets the current user
|
|
497
|
+
>>> session = user.get_sessions()[0]
|
|
498
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
499
|
+
>>> async_session = session.to_async(async_client)
|
|
500
|
+
"""
|
|
501
|
+
from .aio.user import Session as AsyncSession
|
|
502
|
+
|
|
503
|
+
async_user = self.user.to_async(async_client=async_client)
|
|
504
|
+
return AsyncSession(uuid=self.uuid, data=self.data, user=async_user)
|
geobox/utils.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
|
|
2
2
|
import base64
|
|
3
|
+
import os
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
def xor_encode(s, key=42):
|
|
@@ -8,6 +9,39 @@ def xor_encode(s, key=42):
|
|
|
8
9
|
return encoded_bytes.decode('utf-8')
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
def get_save_path(save_path: str = None) -> str:
|
|
13
|
+
"""
|
|
14
|
+
Get the path where the file should be saved.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
save_path (str, optional): The path to save the file.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
str: The path where the file is saved.
|
|
21
|
+
|
|
22
|
+
Raises:
|
|
23
|
+
ValueError: If save_path does not end with a '/'.
|
|
24
|
+
"""
|
|
25
|
+
# If save_path is provided, check if it ends with a '/'
|
|
26
|
+
if save_path and save_path.endswith('/'):
|
|
27
|
+
return f'{save_path}'
|
|
28
|
+
|
|
29
|
+
if save_path and not save_path.endswith('/'):
|
|
30
|
+
raise ValueError("save_path must end with a '/'")
|
|
31
|
+
|
|
32
|
+
return os.getcwd() + '/'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_unique_filename(save_path: str, file_name: str) -> str:
|
|
36
|
+
base, ext = os.path.splitext(file_name)
|
|
37
|
+
counter = 1
|
|
38
|
+
new_file = f"{save_path}{base}({counter}){ext}"
|
|
39
|
+
while os.path.exists(new_file):
|
|
40
|
+
new_file = f"{save_path}{base}({counter}){ext}"
|
|
41
|
+
counter += 1
|
|
42
|
+
return new_file
|
|
43
|
+
|
|
44
|
+
|
|
11
45
|
def clean_data(data: dict) -> dict:
|
|
12
46
|
"""
|
|
13
47
|
Cleans the input data by removing keys with None values.
|
geobox/vectorlayer.py
CHANGED
|
@@ -17,6 +17,8 @@ if TYPE_CHECKING:
|
|
|
17
17
|
from .user import User
|
|
18
18
|
from .file import File
|
|
19
19
|
from .attachment import Attachment
|
|
20
|
+
from .aio import AsyncGeoboxClient
|
|
21
|
+
from .aio.vectorlayer import VectorLayer as AsyncVectorLayer
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
class VectorLayer(Base):
|
|
@@ -337,6 +339,16 @@ class VectorLayer(Base):
|
|
|
337
339
|
def make_permanent(self) -> None:
|
|
338
340
|
"""
|
|
339
341
|
Make the layer permanent.
|
|
342
|
+
|
|
343
|
+
Returns:
|
|
344
|
+
None
|
|
345
|
+
|
|
346
|
+
Example:
|
|
347
|
+
>>> from geobox import GeoboxClient
|
|
348
|
+
>>> from geobox.vectorlayer import VectorLayer
|
|
349
|
+
>>> client = GeoboxClient()
|
|
350
|
+
>>> layer = VectorLayer.get_vector(api=client, uuid="12345678-1234-5678-1234-567812345678")
|
|
351
|
+
>>> layer.make_permanent()
|
|
340
352
|
"""
|
|
341
353
|
endpoint = urljoin(self.endpoint, 'makePermanent/')
|
|
342
354
|
response = self.api.post(endpoint, is_json=False)
|
|
@@ -543,7 +555,7 @@ class VectorLayer(Base):
|
|
|
543
555
|
Get a specific field by its name.
|
|
544
556
|
|
|
545
557
|
Args:
|
|
546
|
-
name (str
|
|
558
|
+
name (str): The name of the field to retrieve.
|
|
547
559
|
|
|
548
560
|
Returns:
|
|
549
561
|
Field: The requested field instance.
|
|
@@ -1003,7 +1015,7 @@ class VectorLayer(Base):
|
|
|
1003
1015
|
|
|
1004
1016
|
def get_tile_pbf_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}') -> str:
|
|
1005
1017
|
"""
|
|
1006
|
-
Get a vector tile for the layer.
|
|
1018
|
+
Get a vector tile pbf url for the layer.
|
|
1007
1019
|
|
|
1008
1020
|
Args:
|
|
1009
1021
|
x (int, optional): X coordinate of the tile.
|
|
@@ -1062,6 +1074,25 @@ class VectorLayer(Base):
|
|
|
1062
1074
|
>>> setting = layer.setting
|
|
1063
1075
|
"""
|
|
1064
1076
|
return super()._get_settings(endpoint=self.endpoint)
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
def update_settings(self, settings: Dict) -> Dict:
|
|
1080
|
+
"""
|
|
1081
|
+
Update the settings
|
|
1082
|
+
|
|
1083
|
+
settings (Dict): settings dictionary
|
|
1084
|
+
|
|
1085
|
+
Returns:
|
|
1086
|
+
Dict: updated settings
|
|
1087
|
+
|
|
1088
|
+
Example:
|
|
1089
|
+
>>> from geobox import GeoboxClient
|
|
1090
|
+
>>> client = GeoboxClient()
|
|
1091
|
+
>>> layer1 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
1092
|
+
>>> layer2 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
1093
|
+
>>> layer1.update_settings(layer2.settings)
|
|
1094
|
+
"""
|
|
1095
|
+
return super()._set_settings(self.endpoint, settings)
|
|
1065
1096
|
|
|
1066
1097
|
|
|
1067
1098
|
def set_settings(self, **kwargs) -> Dict:
|
|
@@ -1292,7 +1323,7 @@ class VectorLayer(Base):
|
|
|
1292
1323
|
>>> from geobox.vectorlayer import VectorLayer
|
|
1293
1324
|
>>> client = GeoboxClient()
|
|
1294
1325
|
>>> layer = VectorLayer.get_vector(api=client, uuid="12345678-1234-5678-1234-567812345678")
|
|
1295
|
-
>>> file = client.
|
|
1326
|
+
>>> file = client.get_file(uuid="12345678-1234-5678-1234-567812345678")
|
|
1296
1327
|
>>> layer.create_attachment(name='test', loc_x=10, loc_y=10, file=file)
|
|
1297
1328
|
"""
|
|
1298
1329
|
from .attachment import Attachment
|
|
@@ -1305,4 +1336,28 @@ class VectorLayer(Base):
|
|
|
1305
1336
|
file=file,
|
|
1306
1337
|
feature=feature,
|
|
1307
1338
|
display_name=display_name,
|
|
1308
|
-
description=description)
|
|
1339
|
+
description=description)
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncVectorLayer':
|
|
1343
|
+
"""
|
|
1344
|
+
Switch to async version of the vector layer instance to have access to the async methods
|
|
1345
|
+
|
|
1346
|
+
Args:
|
|
1347
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
1348
|
+
|
|
1349
|
+
Returns:
|
|
1350
|
+
geobox.aio.vectorlayer.VectorLayer: the async instance of the vector layer.
|
|
1351
|
+
|
|
1352
|
+
Example:
|
|
1353
|
+
>>> from geobox import Geoboxclient
|
|
1354
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
1355
|
+
>>> from geobox.vectorlayer import VectorLayer
|
|
1356
|
+
>>> client = GeoboxClient()
|
|
1357
|
+
>>> layer = VectorLayer.get_vector(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
1358
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
1359
|
+
>>> async_layer = layer.to_async(async_client)
|
|
1360
|
+
"""
|
|
1361
|
+
from .aio.vectorlayer import VectorLayer as AsyncVectorLayer
|
|
1362
|
+
|
|
1363
|
+
return AsyncVectorLayer(api=async_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
|
geobox/version.py
CHANGED
|
@@ -5,6 +5,8 @@ from .base import Base
|
|
|
5
5
|
if TYPE_CHECKING:
|
|
6
6
|
from .api import GeoboxClient
|
|
7
7
|
from .user import User
|
|
8
|
+
from .aio import AsyncGeoboxClient
|
|
9
|
+
from .aio.version import VectorLayerVersion as AsyncVectorLayerVersion
|
|
8
10
|
|
|
9
11
|
class VectorLayerVersion(Base):
|
|
10
12
|
|
|
@@ -246,4 +248,26 @@ class VectorLayerVersion(Base):
|
|
|
246
248
|
}
|
|
247
249
|
return super()._get_shared_users(self.endpoint, params)
|
|
248
250
|
|
|
249
|
-
|
|
251
|
+
|
|
252
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncVectorLayerVersion':
|
|
253
|
+
"""
|
|
254
|
+
Switch to async version of the version instance to have access to the async methods
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
geobox.aio.version.VectorLayerVersion: the async instance of the version.
|
|
261
|
+
|
|
262
|
+
Example:
|
|
263
|
+
>>> from geobox import Geoboxclient
|
|
264
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
265
|
+
>>> from geobox.version import VectorLayerversion
|
|
266
|
+
>>> client = GeoboxClient()
|
|
267
|
+
>>> version = VectorLayerversion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
268
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
269
|
+
>>> async_version = version.to_async(async_client)
|
|
270
|
+
"""
|
|
271
|
+
from .aio.version import VectorLayerVersion as AsyncVectorLayerVersion
|
|
272
|
+
|
|
273
|
+
return AsyncVectorLayerVersion(api=async_client, uuid=self.uuid, data=self.data)
|
geobox/view.py
CHANGED
|
@@ -11,17 +11,12 @@ if TYPE_CHECKING:
|
|
|
11
11
|
from .task import Task
|
|
12
12
|
from .file import File
|
|
13
13
|
from .attachment import Attachment
|
|
14
|
-
|
|
14
|
+
from .aio import AsyncGeoboxClient
|
|
15
|
+
from .aio.view import VectorLayerView as AsyncVectorLayerView
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class VectorLayerView(VectorLayer):
|
|
18
|
-
"""
|
|
19
|
-
A class representing a vector layer view in Geobox.
|
|
20
19
|
|
|
21
|
-
This class provides functionality to create, manage, and manipulate vector layer views.
|
|
22
|
-
It supports various operations including CRUD operations on views, as well as advanced operations like getting fields, features, and sharing views.
|
|
23
|
-
It also provides properties to access the view data, and a method to update the view.
|
|
24
|
-
"""
|
|
25
20
|
BASE_ENDPOINT = 'vectorLayerViews/'
|
|
26
21
|
|
|
27
22
|
def __init__(self,
|
|
@@ -78,7 +73,7 @@ class VectorLayerView(VectorLayer):
|
|
|
78
73
|
api (GeoboxClient): The GeoboxClient instance for making requests.
|
|
79
74
|
|
|
80
75
|
Keyword Args:
|
|
81
|
-
layer_id(int): The id of the layer.
|
|
76
|
+
layer_id(int): The id of the source vector layer.
|
|
82
77
|
include_settings(bool): Whether to include the settings of the layer. default is False.
|
|
83
78
|
q(str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
|
|
84
79
|
search(str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
|
|
@@ -251,9 +246,9 @@ class VectorLayerView(VectorLayer):
|
|
|
251
246
|
>>> from geobox.view import VectorLayerView
|
|
252
247
|
>>> client = GeoboxClient()
|
|
253
248
|
>>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
254
|
-
>>> view.
|
|
255
|
-
>>> view.
|
|
256
|
-
>>> view.
|
|
249
|
+
>>> view.update(name="new_name")
|
|
250
|
+
>>> view.update(display_name="new_display_name")
|
|
251
|
+
>>> view.update(description="new_description")
|
|
257
252
|
"""
|
|
258
253
|
return super().update(name=kwargs.get('name'), display_name=kwargs.get('display_name'), description=kwargs.get('description'))
|
|
259
254
|
|
|
@@ -508,7 +503,8 @@ class VectorLayerView(VectorLayer):
|
|
|
508
503
|
NotFoundError: If the feature with the specified ID is not found.
|
|
509
504
|
|
|
510
505
|
Example:
|
|
511
|
-
>>> from geobox import GeoboxClient
|
|
506
|
+
>>> from geobox import GeoboxClient
|
|
507
|
+
>>> from geobox.view import VectorLayerView
|
|
512
508
|
>>> client = GeoboxClient()
|
|
513
509
|
>>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
514
510
|
>>> feature = view.get_feature(id=1)
|
|
@@ -665,9 +661,9 @@ class VectorLayerView(VectorLayer):
|
|
|
665
661
|
bbox, out_srid, zipped, feature_ids, bbox_srid, q, fields)
|
|
666
662
|
|
|
667
663
|
|
|
668
|
-
def get_tile_pbf_url(self, x: int, y: int, z: int) -> str:
|
|
664
|
+
def get_tile_pbf_url(self, x: int = '{x}', y: int = '{y}', z: int = '{z}') -> str:
|
|
669
665
|
"""
|
|
670
|
-
Get a vector tile for the
|
|
666
|
+
Get a vector tile pbf url for the view.
|
|
671
667
|
|
|
672
668
|
Args:
|
|
673
669
|
x (int): X coordinate of the tile.
|
|
@@ -722,6 +718,25 @@ class VectorLayerView(VectorLayer):
|
|
|
722
718
|
return super().settings
|
|
723
719
|
|
|
724
720
|
|
|
721
|
+
def update_settings(self, settings: Dict) -> Dict:
|
|
722
|
+
"""
|
|
723
|
+
Update the settings
|
|
724
|
+
|
|
725
|
+
settings (Dict): settings dictionary
|
|
726
|
+
|
|
727
|
+
Returns:
|
|
728
|
+
Dict: updated settings
|
|
729
|
+
|
|
730
|
+
Example:
|
|
731
|
+
>>> from geobox import GeoboxClient
|
|
732
|
+
>>> client = GeoboxClient()
|
|
733
|
+
>>> view1 = client.get_view(uuid="12345678-1234-5678-1234-567812345678")
|
|
734
|
+
>>> view2 = client.get_view(uuid="12345678-1234-5678-1234-567812345678")
|
|
735
|
+
>>> view1.update_settings(view2.settings)
|
|
736
|
+
"""
|
|
737
|
+
return super().update_settings(settings)
|
|
738
|
+
|
|
739
|
+
|
|
725
740
|
def set_settings(self, **kwargs) -> Dict:
|
|
726
741
|
"""
|
|
727
742
|
Set the settings of the Vector Layer.
|
|
@@ -940,4 +955,28 @@ class VectorLayerView(VectorLayer):
|
|
|
940
955
|
file=file,
|
|
941
956
|
feature=feature,
|
|
942
957
|
display_name=display_name,
|
|
943
|
-
description=description)
|
|
958
|
+
description=description)
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncVectorLayerView':
|
|
962
|
+
"""
|
|
963
|
+
Switch to async version of the view instance to have access to the async methods
|
|
964
|
+
|
|
965
|
+
Args:
|
|
966
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
967
|
+
|
|
968
|
+
Returns:
|
|
969
|
+
geobox.aio.view.VectorLayerView: the async instance of the view.
|
|
970
|
+
|
|
971
|
+
Example:
|
|
972
|
+
>>> from geobox import Geoboxclient
|
|
973
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
974
|
+
>>> from geobox.view import VectorLayerView
|
|
975
|
+
>>> client = GeoboxClient()
|
|
976
|
+
>>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
977
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
978
|
+
>>> async_view = view.to_async(async_client)
|
|
979
|
+
"""
|
|
980
|
+
from .aio.view import VectorLayerView as AsyncVectorLayerView
|
|
981
|
+
|
|
982
|
+
return AsyncVectorLayerView(api=async_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
|
geobox/workflow.py
CHANGED
|
@@ -5,6 +5,8 @@ from .base import Base
|
|
|
5
5
|
if TYPE_CHECKING:
|
|
6
6
|
from . import GeoboxClient
|
|
7
7
|
from .user import User
|
|
8
|
+
from .aio import AsyncGeoboxClient
|
|
9
|
+
from .aio.workflow import Workflow as AsyncWorkflow
|
|
8
10
|
|
|
9
11
|
class Workflow(Base):
|
|
10
12
|
|
|
@@ -20,7 +22,7 @@ class Workflow(Base):
|
|
|
20
22
|
Args:
|
|
21
23
|
api (GeoboxClient): The GeoboxClient instance for making requests.
|
|
22
24
|
uuid (str): The unique identifier for the workflow.
|
|
23
|
-
data (Dict): The data of the workflow.
|
|
25
|
+
data (Dict): The response data of the workflow.
|
|
24
26
|
"""
|
|
25
27
|
super().__init__(api, uuid=uuid, data=data)
|
|
26
28
|
|
|
@@ -312,3 +314,27 @@ class Workflow(Base):
|
|
|
312
314
|
'limit': limit
|
|
313
315
|
}
|
|
314
316
|
return super()._get_shared_users(self.endpoint, params)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncWorkflow':
|
|
320
|
+
"""
|
|
321
|
+
Switch to async version of the workflow instance to have access to the async methods
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
geobox.aio.workflow.Workflow: the async instance of the workflow.
|
|
328
|
+
|
|
329
|
+
Example:
|
|
330
|
+
>>> from geobox import Geoboxclient
|
|
331
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
332
|
+
>>> from geobox.workflow import Workflow
|
|
333
|
+
>>> client = GeoboxClient()
|
|
334
|
+
>>> workflow = Workflow.get_workflow(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
335
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
336
|
+
>>> async_workflow = workflow.to_async(async_client)
|
|
337
|
+
"""
|
|
338
|
+
from .aio.workflow import Workflow as AsyncWorkflow
|
|
339
|
+
|
|
340
|
+
return AsyncWorkflow(api=async_client, uuid=self.uuid, data=self.data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geobox
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: SDK for Geobox's APIs
|
|
5
5
|
Author-email: Hamid Heydari <heydari.h62@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -17,11 +17,14 @@ Requires-Dist: pyproj; extra == "geometry"
|
|
|
17
17
|
Provides-Extra: tqdm
|
|
18
18
|
Requires-Dist: tqdm; extra == "tqdm"
|
|
19
19
|
Requires-Dist: ipywidgets; extra == "tqdm"
|
|
20
|
+
Provides-Extra: async
|
|
21
|
+
Requires-Dist: aiohttp; extra == "async"
|
|
20
22
|
Provides-Extra: all
|
|
21
23
|
Requires-Dist: shapely; extra == "all"
|
|
22
24
|
Requires-Dist: pyproj; extra == "all"
|
|
23
25
|
Requires-Dist: tqdm; extra == "all"
|
|
24
26
|
Requires-Dist: ipywidgets; extra == "all"
|
|
27
|
+
Requires-Dist: aiohttp; extra == "all"
|
|
25
28
|
Dynamic: license-file
|
|
26
29
|
|
|
27
30
|
[<img width="200" alt="Geobox logo" src="https://www.geobox.ir/wp-content/uploads/2022/05/geologo-slider.png">](https://www.geobox.ir/)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
geobox/__init__.py,sha256=ne0OfIpHDw_RiSuNmk1APBL66jAYXXPn_FAKHzkBrRM,1895
|
|
2
|
+
geobox/api.py,sha256=zGlroMvfb_mnFQXCDJTpNYYecIE-IAL2vXBVpxCHq2U,105298
|
|
3
|
+
geobox/apikey.py,sha256=p1kmnpjIa41vVKrz2nApWFQltorv68MNawtIWz5Ja0k,8562
|
|
4
|
+
geobox/attachment.py,sha256=kbTmEayMf66f7gIS8uhD36SdnQrl1Nq_DRXjBdCeXDI,13026
|
|
5
|
+
geobox/base.py,sha256=-7Qsxw7OzgtFygKqaDVB__HxmUqA521XGxj9ibtTmO8,12967
|
|
6
|
+
geobox/basemap.py,sha256=998m2lpgESIGsJuADWFnqg5eShskCtlp6Qcri4IM6Hg,5587
|
|
7
|
+
geobox/dashboard.py,sha256=iBK1ZFl3pM95q0lFAeRDnuk2vhhfm9-zBV0YOTKXAu0,12821
|
|
8
|
+
geobox/enums.py,sha256=Ur8zbUjfx09oxXb-uzwFfDT_Nt8I4AP5pFQKJ9bxVxI,6204
|
|
9
|
+
geobox/exception.py,sha256=jvpnv0M2Ck1FpxHTL_aKYWxGvLnCQ3d9vOrMIktjw1U,1507
|
|
10
|
+
geobox/feature.py,sha256=PphGJLSya2FR-JSaC7lE0YE-nf2A2wHPTCG3Rj6iz9Y,19239
|
|
11
|
+
geobox/field.py,sha256=ZNbuf3ayemyguVee10yCKH4aq62xUEmY--qQLTeRz4Q,10897
|
|
12
|
+
geobox/file.py,sha256=RkRlHORGa1ybWFrK-QFavEPiRrcU5OBhNwfcc_gpfzE,20217
|
|
13
|
+
geobox/layout.py,sha256=a0lkrl2ondvgOM-BwRuMgEmzo-C7frFJzC7MuX2MNl8,12348
|
|
14
|
+
geobox/log.py,sha256=-BHQdXooUKD-ETslxHuv9SGhlk8yzzRizSSiK404Y0I,5007
|
|
15
|
+
geobox/map.py,sha256=CGorSxO5vuiOtmwUs3Mk4PeOg-HF5py3sRo6ahx9GF8,38074
|
|
16
|
+
geobox/model3d.py,sha256=e_d_E7yj-Ria3oJm9V14vfXV-g1iMHa7u7sl9Or4FlA,14938
|
|
17
|
+
geobox/mosaic.py,sha256=Ceh_kleRlZqBSDTTV27iwahG-TGsdpVzUyXcB3dbJIo,25128
|
|
18
|
+
geobox/plan.py,sha256=f7ciVE_VKM7onuzE3bGK63XxxrtfUsMv16oImyDgZ3c,13061
|
|
19
|
+
geobox/query.py,sha256=C0tqAEjqExb5a_0kO9mr63i62DobKwwDWphNQTU6WTE,25499
|
|
20
|
+
geobox/raster.py,sha256=YSO-Qc73PWu2jIZdoF2xfqgVlBKGgAiYUhswjbgBfrY,31098
|
|
21
|
+
geobox/route.py,sha256=cKZTTHBHM8woWbhHIpCvrRX_doJcTkGktouee0z7oG0,2723
|
|
22
|
+
geobox/scene.py,sha256=iUkMxH4YqPk3vCIQq1uAZgQGWUvtujKBylUWcmUpQkM,12356
|
|
23
|
+
geobox/settings.py,sha256=ue6vZYYIirisYBwnuTsZnV7fG0jOQampX1xroC5lpdk,6856
|
|
24
|
+
geobox/task.py,sha256=xc7UyyRm3cmzH1uznOZ-osRGSAdVufIQsmeVuoJ-IWs,14505
|
|
25
|
+
geobox/tile3d.py,sha256=nEFs2TuzJFC9k__rPlkWwL6s-WjIsyQZS5FEhmfsck0,12093
|
|
26
|
+
geobox/tileset.py,sha256=wk0vSSON0DHiO6NzaScZnmu7d424jFCgNk0kJLDAtA8,25041
|
|
27
|
+
geobox/usage.py,sha256=47nR-JDA3yfsK-o3eWSYA7FeDVJNPIIfvsRTGkfNv9A,9215
|
|
28
|
+
geobox/user.py,sha256=GFQTw8EwLcyf-AMatmejtrgnSHB6Qg-ctE5YrzYIMEQ,17509
|
|
29
|
+
geobox/utils.py,sha256=JmlRqDVIo0vBikzH1XakRrCrEIfLA7_eTJnBWBvGhJI,2243
|
|
30
|
+
geobox/vectorlayer.py,sha256=_i1RdIw_P9BglnsERDLRxDRz6RU3tP7kVjFnRGepfyk,58622
|
|
31
|
+
geobox/version.py,sha256=6IO8AHVTbS4z-cwaqqPt0o3ggwmskimKUoUoeFzx5UE,10560
|
|
32
|
+
geobox/view.py,sha256=fUWOC_ZJ5mg6T0jHYJ5-rb7k2blI_EWT_lu4yE-cD_c,42333
|
|
33
|
+
geobox/workflow.py,sha256=Gi4AJlsvo_SFY3Ptgp_3sg_f37eIZNL2whn2yMW8Dkg,12666
|
|
34
|
+
geobox/aio/__init__.py,sha256=EO8VP0d5JPPZH1o1CBdwSMkPZOpyGPK0v9UbIvf6g7w,1906
|
|
35
|
+
geobox/aio/api.py,sha256=NIVHOKNA_UWD4V-prLmzxEQOFhkHJL4LW0fnXbn53BM,112430
|
|
36
|
+
geobox/aio/apikey.py,sha256=J_4XqTJ3PZUxsOqR1F-WIbpWzIihX32Y2sjPdSEUboY,9232
|
|
37
|
+
geobox/aio/attachment.py,sha256=EXBdtlb5aKlnm5GHWDfX67v0mFON5gDBtF13rknETYM,13644
|
|
38
|
+
geobox/aio/base.py,sha256=-B56CC7uMbb84DzT1YzytpOwalFRZ8mAtaVajcE4cNI,9189
|
|
39
|
+
geobox/aio/basemap.py,sha256=HFwvNKMQVB1RJ9hGrCHiG_AtMGiy3Z1WStmHqrhFGeU,5950
|
|
40
|
+
geobox/aio/dashboard.py,sha256=xp1SydoQ2zEu1afFcGFF4jRwbOD1CUyuflALpGukL1g,13588
|
|
41
|
+
geobox/aio/feature.py,sha256=wQgfpzo9gtR8XsvAZi6IAna3mZVqYf9xqnl4ZV_lWY4,20186
|
|
42
|
+
geobox/aio/field.py,sha256=shZFodWTtoczAfs0n5JZ6kCVqD2r6dLQP_27tJ6jSSw,11568
|
|
43
|
+
geobox/aio/file.py,sha256=ZabKAvnxfiJFWODPm5cMbjTR9LNATdPR7aU0HeSSI70,21316
|
|
44
|
+
geobox/aio/layout.py,sha256=5YqyqhbOKoZDAqFOvmdxtlUiauOqzZ-ZNmc1wIU00vE,13056
|
|
45
|
+
geobox/aio/log.py,sha256=dlKAq9e7rdsEDZ9lI3GjZe8DTQNrta-BfBJKNkHwgGs,5299
|
|
46
|
+
geobox/aio/map.py,sha256=cOSCSVF3ERWXkMnneGLUryNZsXiScerLzmDw7K81uNE,40441
|
|
47
|
+
geobox/aio/model3d.py,sha256=Gg1fbfNILMeLjBwS6vxcPx-AJWdriIGKtkJ6b06GxsE,15959
|
|
48
|
+
geobox/aio/mosaic.py,sha256=wqXzrK9C-rZeMVamurqZj5Og6rSruvXBssnYfpWmt-g,27029
|
|
49
|
+
geobox/aio/plan.py,sha256=pUBfmd-AfzAn7ejv3x2mp3cYr5mM9nMMdO-YDh1JDVY,13690
|
|
50
|
+
geobox/aio/query.py,sha256=iLHt2MIzCP8ayUCahWMy1yPR0e9w9wZutNzp2M-FisA,27011
|
|
51
|
+
geobox/aio/raster.py,sha256=dPCfoD-OP5o4lgX87edYDmOgl4R-APyaNcbU6H5Y13A,33084
|
|
52
|
+
geobox/aio/route.py,sha256=YCTcAfaSFE429fpL4eIb2VrBEdBo6SmolPomVM1F66A,2854
|
|
53
|
+
geobox/aio/scene.py,sha256=cxQdFkFD-Z-ZWJyhrW_W53DyUVILmEQgJoFaG3KU_FI,13130
|
|
54
|
+
geobox/aio/settings.py,sha256=q1B2iZf0ekl21cByP5P9Z0ivWCDxw8UNi16NOXm76qA,7042
|
|
55
|
+
geobox/aio/task.py,sha256=6TEwrBqpT3YWRLo9_c0U9WFs1SHsX3h5Xe0m7XbjHR4,15329
|
|
56
|
+
geobox/aio/tile3d.py,sha256=QWYdmMQSlWqztflLTqFDqQaynkgRLoVZPF4NlwOMqDg,12935
|
|
57
|
+
geobox/aio/tileset.py,sha256=LUsCtafwFCYqG41vNNlbe3GyWXjJ1_UYV-4o7-w-Xk8,27379
|
|
58
|
+
geobox/aio/usage.py,sha256=AC2TPsomnK-W7EbXOGP6Flkkeh7n4KRCJmBuTdIofQo,9776
|
|
59
|
+
geobox/aio/user.py,sha256=k3JCPQpwiIzJBP6xvKsPkueElW6e1i9a-odNAOIZB9U,18622
|
|
60
|
+
geobox/aio/vectorlayer.py,sha256=1635i0Vc4mvcYmgTx53sanpZJYLe5Ho4YsO2pEPH23A,62087
|
|
61
|
+
geobox/aio/version.py,sha256=HAKB9jHGZ0-EirNg9aNwYYPVFT3YOYQ0JNCxP7Nvk9g,11201
|
|
62
|
+
geobox/aio/view.py,sha256=peTf__JNMqdiTb6VQeuhj_RqljzcskbwwDaHhQ3Cf9w,45353
|
|
63
|
+
geobox/aio/workflow.py,sha256=itqTO7XlO1YmLd7pnS5BHhaC48ykEmYDXPs-2hDxey4,13411
|
|
64
|
+
geobox-2.0.0.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
|
|
65
|
+
geobox-2.0.0.dist-info/METADATA,sha256=wrMvTlsryT7tzWgl7NcLvaeVn8yxPB26qEgz5dijo68,2760
|
|
66
|
+
geobox-2.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
67
|
+
geobox-2.0.0.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
|
|
68
|
+
geobox-2.0.0.dist-info/RECORD,,
|