geobox 1.3.2__py3-none-any.whl → 1.3.3__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/api.py +6 -11
- geobox/enums.py +0 -6
- geobox/query.py +5 -7
- geobox/tileset.py +66 -30
- {geobox-1.3.2.dist-info → geobox-1.3.3.dist-info}/METADATA +1 -1
- {geobox-1.3.2.dist-info → geobox-1.3.3.dist-info}/RECORD +9 -9
- {geobox-1.3.2.dist-info → geobox-1.3.3.dist-info}/WHEEL +0 -0
- {geobox-1.3.2.dist-info → geobox-1.3.3.dist-info}/licenses/LICENSE +0 -0
- {geobox-1.3.2.dist-info → geobox-1.3.3.dist-info}/top_level.txt +0 -0
geobox/api.py
CHANGED
|
@@ -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,
|
geobox/enums.py
CHANGED
geobox/query.py
CHANGED
|
@@ -624,18 +624,16 @@ class Query(Base):
|
|
|
624
624
|
return endpoint
|
|
625
625
|
|
|
626
626
|
|
|
627
|
-
def save_as_layer(self, layer_name: str, layer_type: 'QueryGeometryType') ->
|
|
627
|
+
def save_as_layer(self, layer_name: str, layer_type: 'QueryGeometryType' = None) -> Task:
|
|
628
628
|
"""
|
|
629
629
|
Saves the query as a new layer.
|
|
630
630
|
|
|
631
631
|
Args:
|
|
632
|
-
sql (str): The SQL statement for the query.
|
|
633
|
-
params (list): The parameters for the SQL statement.
|
|
634
632
|
layer_name (str): The name of the new layer.
|
|
635
|
-
layer_type (QueryGeometryType): The type of the new layer.
|
|
633
|
+
layer_type (QueryGeometryType, optional): The type of the new layer.
|
|
636
634
|
|
|
637
635
|
Returns:
|
|
638
|
-
|
|
636
|
+
Task: The response task object.
|
|
639
637
|
|
|
640
638
|
Raises:
|
|
641
639
|
PermissionError: If the query is a read-only system query.
|
|
@@ -645,7 +643,7 @@ class Query(Base):
|
|
|
645
643
|
>>> from geobox.query import Query
|
|
646
644
|
>>> client = GeoboxClient()
|
|
647
645
|
>>> query = Query.get_query(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
648
|
-
>>> query.save_as_layer(layer_name='test'
|
|
646
|
+
>>> query.save_as_layer(layer_name='test')
|
|
649
647
|
"""
|
|
650
648
|
self._check_access()
|
|
651
649
|
|
|
@@ -659,7 +657,7 @@ class Query(Base):
|
|
|
659
657
|
"sql": self.sql,
|
|
660
658
|
"params": params,
|
|
661
659
|
"layer_name": layer_name,
|
|
662
|
-
"layer_type": layer_type.value
|
|
660
|
+
"layer_type": layer_type.value if layer_type else None
|
|
663
661
|
})
|
|
664
662
|
|
|
665
663
|
endpoint = urljoin(self.BASE_ENDPOINT, 'saveAsLayer/')
|
geobox/tileset.py
CHANGED
|
@@ -3,8 +3,8 @@ from typing import Dict, List, Optional, Union, TYPE_CHECKING
|
|
|
3
3
|
|
|
4
4
|
from .base import Base
|
|
5
5
|
from .vectorlayer import VectorLayer
|
|
6
|
+
from .view import VectorLayerView
|
|
6
7
|
from .task import Task
|
|
7
|
-
from .enums import TilesetLayerType
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from . import GeoboxClient
|
|
@@ -35,7 +35,7 @@ class Tileset(Base):
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
@classmethod
|
|
38
|
-
def create_tileset(cls, api: 'GeoboxClient', name: str, layers: List[
|
|
38
|
+
def create_tileset(cls, api: 'GeoboxClient', name: str, layers: List[Union['VectorLayer', 'VectorLayerView']], display_name: str = None, description: str = None,
|
|
39
39
|
min_zoom: int = None, max_zoom: int = None, user_id: int = None) -> 'Tileset':
|
|
40
40
|
"""
|
|
41
41
|
Create a new tileset.
|
|
@@ -43,9 +43,7 @@ class Tileset(Base):
|
|
|
43
43
|
Args:
|
|
44
44
|
api (GeoboxClient): The GeoboxClient instance for making requests.
|
|
45
45
|
name (str): The name of the tileset.
|
|
46
|
-
layers (List[
|
|
47
|
-
- layer_type: The type of the layer. valid values are "vector" and "view".
|
|
48
|
-
- layer_uuid: The uuid of the layer.
|
|
46
|
+
layers (List['VectorLayer' | 'VectorLayerView']): list of vectorlayer and view objects to add to tileset.
|
|
49
47
|
display_name (str, optional): The display name of the tileset.
|
|
50
48
|
description (str, optional): The description of the tileset.
|
|
51
49
|
min_zoom (int, optional): The minimum zoom level of the tileset.
|
|
@@ -59,34 +57,46 @@ class Tileset(Base):
|
|
|
59
57
|
>>> from geobox import GeoboxClient
|
|
60
58
|
>>> from geobox.tileset import Tileset
|
|
61
59
|
>>> client = GeoboxClient()
|
|
62
|
-
>>>
|
|
63
|
-
|
|
64
|
-
... "layer_type": "vector",
|
|
65
|
-
... "layer_uuid": "12345678-1234-5678-1234-567812345678"
|
|
66
|
-
... }
|
|
67
|
-
... ]
|
|
60
|
+
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
61
|
+
>>> view = client.get_view(uuid="12345678-1234-5678-1234-567812345678")
|
|
68
62
|
>>> tileset = Tileset.create_tileset(client,
|
|
69
63
|
... name="your_tileset_name",
|
|
70
64
|
... display_name="Your Tileset",
|
|
71
65
|
... description="Your description",
|
|
72
66
|
... min_zoom=0,
|
|
73
67
|
... max_zoom=14,
|
|
74
|
-
... layers=
|
|
68
|
+
... layers=[layer, view])
|
|
75
69
|
or
|
|
76
70
|
>>> tileset = client.create_tileset(name="your_tileset_name",
|
|
77
71
|
... display_name="Your Tileset",
|
|
78
72
|
... description="Your description",
|
|
79
73
|
... min_zoom=0,
|
|
80
74
|
... max_zoom=14,
|
|
81
|
-
... layers=
|
|
75
|
+
... layers=[layer, view])
|
|
82
76
|
"""
|
|
77
|
+
formatted_layers = []
|
|
78
|
+
for item in layers:
|
|
79
|
+
if type(item) == VectorLayer:
|
|
80
|
+
item_type = 'vector'
|
|
81
|
+
|
|
82
|
+
elif type(item) == VectorLayerView:
|
|
83
|
+
item_type = 'view'
|
|
84
|
+
|
|
85
|
+
else:
|
|
86
|
+
continue
|
|
87
|
+
|
|
88
|
+
formatted_layers.append({
|
|
89
|
+
'layer_type': item_type,
|
|
90
|
+
'layer_uuid': item.uuid
|
|
91
|
+
})
|
|
92
|
+
|
|
83
93
|
data = {
|
|
84
94
|
"name": name,
|
|
85
95
|
"display_name": display_name,
|
|
86
96
|
"description": description,
|
|
87
97
|
"min_zoom": min_zoom,
|
|
88
98
|
"max_zoom": max_zoom,
|
|
89
|
-
"layers":
|
|
99
|
+
"layers": formatted_layers,
|
|
90
100
|
"user_id": user_id
|
|
91
101
|
}
|
|
92
102
|
return super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: Tileset(api, item['uuid'], item))
|
|
@@ -283,7 +293,7 @@ class Tileset(Base):
|
|
|
283
293
|
super().delete(urljoin(self.BASE_ENDPOINT, f'{self.uuid}/'))
|
|
284
294
|
|
|
285
295
|
|
|
286
|
-
def
|
|
296
|
+
def get_layers(self, **kwargs) -> List['VectorLayer']:
|
|
287
297
|
"""
|
|
288
298
|
Retrieves the layers of the tileset with optional parameters.
|
|
289
299
|
|
|
@@ -307,13 +317,14 @@ class Tileset(Base):
|
|
|
307
317
|
Example:
|
|
308
318
|
|
|
309
319
|
Returns:
|
|
310
|
-
List: A list of VectorLayer instances.
|
|
320
|
+
List: A list of VectorLayer or VectorLayerView instances.
|
|
311
321
|
|
|
312
322
|
Example:
|
|
313
323
|
>>> from geobox import GeoboxClient
|
|
314
324
|
>>> from geobox.tileset import Tileset
|
|
315
325
|
>>> client = GeoboxClient()
|
|
316
|
-
>>>
|
|
326
|
+
>>> tileset = Tileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
327
|
+
>>> layers = tileset.get_layers()
|
|
317
328
|
"""
|
|
318
329
|
params = {
|
|
319
330
|
'f': 'json',
|
|
@@ -328,57 +339,82 @@ class Tileset(Base):
|
|
|
328
339
|
'shared': kwargs.get('shared', False)
|
|
329
340
|
}
|
|
330
341
|
endpoint = urljoin(self.BASE_ENDPOINT, f'{self.uuid}/layers/')
|
|
331
|
-
return super()._get_list(self.api, endpoint, params, factory_func=lambda api, item: VectorLayer(api, item['uuid'], item['layer_type'], item)
|
|
342
|
+
return super()._get_list(self.api, endpoint, params, factory_func=lambda api, item: VectorLayer(api, item['uuid'], item['layer_type'], item) if not item['is_view'] else \
|
|
343
|
+
VectorLayerView(api, item['uuid'], item['layer_type'], item) )
|
|
332
344
|
|
|
333
345
|
|
|
334
|
-
def add_layer(self,
|
|
346
|
+
def add_layer(self, layer: Union['VectorLayer', 'VectorLayerView']) -> None:
|
|
335
347
|
"""
|
|
336
348
|
Adds a layer to the tileset.
|
|
337
349
|
|
|
338
350
|
Args:
|
|
339
|
-
|
|
340
|
-
layer_uuid (str): The UUID of the layer.
|
|
351
|
+
layer (VectorLayer | VectorLayerView): the layer object to add to the tileset
|
|
341
352
|
|
|
342
353
|
Returns:
|
|
343
354
|
None
|
|
344
355
|
|
|
356
|
+
Raises:
|
|
357
|
+
ValueError: if the layer input is not a 'VectorLayer' or 'VetorLayerview' object
|
|
358
|
+
|
|
345
359
|
Example:
|
|
346
360
|
>>> from geobox import GeoboxClient
|
|
347
361
|
>>> from geobox.tileset import Tileset
|
|
348
362
|
>>> client = GeoboxClient()
|
|
349
363
|
>>> tileset = Tileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
350
|
-
>>>
|
|
364
|
+
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
365
|
+
>>> tileset.add_layer(layer)
|
|
351
366
|
"""
|
|
367
|
+
if type(layer) == VectorLayer:
|
|
368
|
+
layer_type = 'vector'
|
|
369
|
+
|
|
370
|
+
elif type(layer) == VectorLayerView:
|
|
371
|
+
layer_type = 'view'
|
|
372
|
+
|
|
373
|
+
else:
|
|
374
|
+
raise ValueError("layer input must be either 'VectorLayer' or 'VetorLayerview' object")
|
|
375
|
+
|
|
352
376
|
data = {
|
|
353
|
-
"layer_type": layer_type
|
|
354
|
-
"layer_uuid":
|
|
377
|
+
"layer_type": layer_type,
|
|
378
|
+
"layer_uuid": layer.uuid
|
|
355
379
|
}
|
|
356
380
|
|
|
357
381
|
endpoint = urljoin(self.endpoint, 'layers/')
|
|
358
382
|
return self.api.post(endpoint, data, is_json=False)
|
|
359
383
|
|
|
360
384
|
|
|
361
|
-
def delete_layer(self,
|
|
385
|
+
def delete_layer(self, layer: Union['VectorLayer', 'VectorLayerView']) -> None:
|
|
362
386
|
"""
|
|
363
387
|
Deletes a layer from the tileset.
|
|
364
388
|
|
|
365
389
|
Args:
|
|
366
|
-
|
|
367
|
-
layer_uuid (str): The UUID of the layer.
|
|
390
|
+
layer (VectorLayer | VectorLayerView): the layer object to delete from the tileset
|
|
368
391
|
|
|
369
392
|
Returns:
|
|
370
393
|
None
|
|
371
394
|
|
|
395
|
+
Raises:
|
|
396
|
+
ValueError: if the layer input is not a 'VectorLayer' or 'VetorLayerview' object
|
|
397
|
+
|
|
372
398
|
Example:
|
|
373
399
|
>>> from geobox import GeoboxClient
|
|
374
400
|
>>> from geobox.tileset import Tileset
|
|
375
401
|
>>> client = GeoboxClient()
|
|
376
402
|
>>> tileset = Tileset.get_tileset(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
377
|
-
>>>
|
|
403
|
+
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
404
|
+
>>> tileset.delete_layer(layer)
|
|
378
405
|
"""
|
|
406
|
+
if type(layer) == VectorLayer:
|
|
407
|
+
layer_type = 'vector'
|
|
408
|
+
|
|
409
|
+
elif type(layer) == VectorLayerView:
|
|
410
|
+
layer_type = 'view'
|
|
411
|
+
|
|
412
|
+
else:
|
|
413
|
+
raise ValueError("layer input must be either 'VectorLayer' or 'VetorLayerview' object")
|
|
414
|
+
|
|
379
415
|
data = {
|
|
380
|
-
"layer_type": layer_type
|
|
381
|
-
"layer_uuid":
|
|
416
|
+
"layer_type": layer_type,
|
|
417
|
+
"layer_uuid": layer.uuid
|
|
382
418
|
}
|
|
383
419
|
|
|
384
420
|
endpoint = urljoin(self.endpoint, 'layers/')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
geobox/__init__.py,sha256=iRkJAFIjMXiAaLTVXvZcW5HM7ttyipGdxFZ15NCM8qU,1895
|
|
2
|
-
geobox/api.py,sha256=
|
|
2
|
+
geobox/api.py,sha256=spbIWSeYCml_rmiisDLQjFcvm6I_UJGobUJm9H-Z9sQ,100719
|
|
3
3
|
geobox/apikey.py,sha256=FBio1PtGovAUaTE0HW9IJ55UuFdR_1ICk_FQhHu5dAE,7427
|
|
4
4
|
geobox/attachment.py,sha256=XbGwfWWuFAMimj4tsjKBvlSLP-rhpNACCtxgRmUvcdY,11631
|
|
5
5
|
geobox/base.py,sha256=p0UVZo9CINw0mW9o0nNR_VNCk7V1r-FrLQ_NH39WARE,12299
|
|
6
6
|
geobox/basemap.py,sha256=fDWwkMf-F2NTE1tVLijoxQku55825b6gj8nk69TMOII,4386
|
|
7
7
|
geobox/dashboard.py,sha256=MYyT3YJEGPCbTXHcYoZmn14rFOaut1J3idEA8bCdFgI,11762
|
|
8
|
-
geobox/enums.py,sha256=
|
|
8
|
+
geobox/enums.py,sha256=mGF6eXQlNHcUXV0AVMolI200a__g-S9wMjQ1p4ka28g,6244
|
|
9
9
|
geobox/exception.py,sha256=jvpnv0M2Ck1FpxHTL_aKYWxGvLnCQ3d9vOrMIktjw1U,1507
|
|
10
10
|
geobox/feature.py,sha256=3Kbc1LjIkBt1YqRAry84BrR7qxx9BexvBB3YQ8D9mGk,18504
|
|
11
11
|
geobox/field.py,sha256=p9eitUpnsiGj6GUhjSomk6HWlsNJSbE-Oh_4VcjaqVo,10562
|
|
@@ -15,14 +15,14 @@ geobox/map.py,sha256=RjuhbOVQN-OBwjBtO46AosB_Ta348EA1nExBdnxH3nw,31252
|
|
|
15
15
|
geobox/model3d.py,sha256=qRYCx-q9LpGhdu5oz3av0uUoiDimuk4BvXXwMW5bo9Q,12061
|
|
16
16
|
geobox/mosaic.py,sha256=feBRsAgvhl0tKoghfZiQsxFntS7skAnzEYYuU4GKbP0,23672
|
|
17
17
|
geobox/plan.py,sha256=_ZV9F6loG92uQZGJl_9T08Kg85g3hnODmpccSkTYVdw,11193
|
|
18
|
-
geobox/query.py,sha256=
|
|
18
|
+
geobox/query.py,sha256=BGlCnglo7lZwvvmWqeWubafn3gAWE8tT08fBAwxFt4s,24097
|
|
19
19
|
geobox/raster.py,sha256=ex2nUiMGwGN-9Zp3-Fotj9Z2noJRkyDf4-ZhwIponHw,29459
|
|
20
20
|
geobox/route.py,sha256=cKZTTHBHM8woWbhHIpCvrRX_doJcTkGktouee0z7oG0,2723
|
|
21
21
|
geobox/scene.py,sha256=Sz2tiyJk-bXYjktfcp1d2gGrW3gt2T4D1FAMoRHOCng,11369
|
|
22
22
|
geobox/settings.py,sha256=rGRdM18Vo7xnjfZXPLRMbKeoVC_lZmzkNRPS0SQv05o,5660
|
|
23
23
|
geobox/task.py,sha256=eLMgbhcYTADooWqKDPh6Jlh5S5oqxMMKoYIm0YPVZvg,13519
|
|
24
24
|
geobox/tile3d.py,sha256=MHDoj2OIUf3VMQtq7ysrayh8njAPSgwgPJCm4ySEB7A,10472
|
|
25
|
-
geobox/tileset.py,sha256=
|
|
25
|
+
geobox/tileset.py,sha256=I22RQggG4nuxibyf87Pm7uFliH-pAkesHlujaqMRfu8,23499
|
|
26
26
|
geobox/usage.py,sha256=_54xL-n-2Bg9wGpoOBKnh85WqdpMWEtqxRJVaFlVWe0,7908
|
|
27
27
|
geobox/user.py,sha256=YY72uRvjKUUWUZbxhrft37FVBlqDeosPMf3EpMVBhc0,15069
|
|
28
28
|
geobox/utils.py,sha256=qLtchKIdw-az3KCiiFv0-Cpmx9RfBxORjlATvVyDIaQ,1314
|
|
@@ -30,8 +30,8 @@ geobox/vectorlayer.py,sha256=yK_5ZD7eBAbRV2ruZCMptCtNU-S0AMvsAFiGIcLf3LQ,52853
|
|
|
30
30
|
geobox/version.py,sha256=0GLPhxCeEb2bAkdpPJWtXPXc1KP6kQ_TOMwLAL0ldo0,9374
|
|
31
31
|
geobox/view.py,sha256=sIi6Mi7NUAX5gN83cpubD3l7AcZ-1g5kG2NKHeVeW-g,37518
|
|
32
32
|
geobox/workflow.py,sha256=6hKnSw4G0_ZlgmUb0g3fxT-UVsFbiYpF2FbEO5fpQv0,11606
|
|
33
|
-
geobox-1.3.
|
|
34
|
-
geobox-1.3.
|
|
35
|
-
geobox-1.3.
|
|
36
|
-
geobox-1.3.
|
|
37
|
-
geobox-1.3.
|
|
33
|
+
geobox-1.3.3.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
|
|
34
|
+
geobox-1.3.3.dist-info/METADATA,sha256=dU6XTrCrrBCxwcVm01tBYRJfdsUuBErYGUMfdKF7Wu4,2556
|
|
35
|
+
geobox-1.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
36
|
+
geobox-1.3.3.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
|
|
37
|
+
geobox-1.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|