geobox 2.0.1__py3-none-any.whl → 2.2.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 +61 -63
- geobox/aio/__init__.py +61 -63
- geobox/aio/api.py +489 -473
- 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 +23 -33
- 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 +907 -869
- geobox/aio/raster_analysis.py +740 -0
- 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 +315 -306
- geobox/aio/version.py +272 -273
- geobox/aio/view.py +1019 -983
- geobox/aio/workflow.py +340 -341
- geobox/api.py +18 -2
- 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 +432 -348
- geobox/feature.py +5 -5
- 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 +907 -863
- geobox/raster_analysis.py +737 -0
- 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 -5
- geobox/version.py +272 -272
- geobox/view.py +981 -981
- geobox/workflow.py +338 -339
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
- geobox-2.2.0.dist-info/RECORD +72 -0
- geobox-2.0.1.dist-info/RECORD +0 -68
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/top_level.txt +0 -0
geobox/aio/feature.py
CHANGED
|
@@ -6,18 +6,18 @@ from ..enums import FeatureType
|
|
|
6
6
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
8
8
|
from .vectorlayer import VectorLayer
|
|
9
|
-
from ..api import GeoboxClient
|
|
10
|
-
from ..feature import Feature
|
|
9
|
+
from ..api import GeoboxClient
|
|
10
|
+
from ..feature import Feature
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class
|
|
13
|
+
class AsyncFeature(AsyncBase):
|
|
14
14
|
|
|
15
15
|
BASE_SRID = 3857
|
|
16
16
|
|
|
17
17
|
def __init__(self,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
layer: 'VectorLayer',
|
|
19
|
+
srid: Optional[int] = 3857,
|
|
20
|
+
data: Optional[Dict] = {}):
|
|
21
21
|
"""
|
|
22
22
|
Constructs all the necessary attributes for the Feature object.
|
|
23
23
|
|
|
@@ -25,13 +25,6 @@ class Feature(AsyncBase):
|
|
|
25
25
|
layer (VectorLayer): The vector layer this feature belongs to
|
|
26
26
|
srid (int, optional): The Spatial Reference System Identifier (default is 3857)
|
|
27
27
|
data (Dict, optional): The feature data contains the feature geometry and properties
|
|
28
|
-
|
|
29
|
-
Example:
|
|
30
|
-
>>> from geobox import GeoboxClient, Feature
|
|
31
|
-
>>> client = GeoboxClient()
|
|
32
|
-
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
33
|
-
>>> feature = Feature(layer=layer, srid=4326) # example srid set to 4326
|
|
34
|
-
>>> feature.save()
|
|
35
28
|
"""
|
|
36
29
|
super().__init__(api=layer.api)
|
|
37
30
|
self.layer = layer
|
|
@@ -65,7 +58,7 @@ class Feature(AsyncBase):
|
|
|
65
58
|
Returns:
|
|
66
59
|
str: A string representation of the Feature object.
|
|
67
60
|
"""
|
|
68
|
-
return f"
|
|
61
|
+
return f"AsyncFeature(id={self.id}, type={self.feature_type})"
|
|
69
62
|
|
|
70
63
|
|
|
71
64
|
def __getattr__(self, name: str) -> Any:
|
|
@@ -244,7 +237,7 @@ class Feature(AsyncBase):
|
|
|
244
237
|
>>> feature = await layer.get_feature(id=1)
|
|
245
238
|
>>> await feature.delete()
|
|
246
239
|
"""
|
|
247
|
-
await super().
|
|
240
|
+
await super()._delete(self.endpoint)
|
|
248
241
|
|
|
249
242
|
|
|
250
243
|
async def update(self, geojson: Dict) -> Dict:
|
|
@@ -274,7 +267,7 @@ class Feature(AsyncBase):
|
|
|
274
267
|
|
|
275
268
|
|
|
276
269
|
@classmethod
|
|
277
|
-
async def create_feature(cls, layer: 'VectorLayer', geojson: Dict) -> '
|
|
270
|
+
async def create_feature(cls, layer: 'VectorLayer', geojson: Dict) -> 'AsyncFeature':
|
|
278
271
|
"""
|
|
279
272
|
[async] Create a new feature in the vector layer.
|
|
280
273
|
|
|
@@ -283,7 +276,7 @@ class Feature(AsyncBase):
|
|
|
283
276
|
geojson (Dict): The GeoJSON data for the feature
|
|
284
277
|
|
|
285
278
|
Returns:
|
|
286
|
-
|
|
279
|
+
AsyncFeature: The created feature instance
|
|
287
280
|
|
|
288
281
|
Example:
|
|
289
282
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
@@ -297,11 +290,11 @@ class Feature(AsyncBase):
|
|
|
297
290
|
>>> feature = await Feature.create_feature(layer, geojson)
|
|
298
291
|
"""
|
|
299
292
|
endpoint = urljoin(layer.endpoint, 'features/')
|
|
300
|
-
return await cls._create(layer.api, endpoint, geojson, factory_func=lambda api, item:
|
|
293
|
+
return await cls._create(layer.api, endpoint, geojson, factory_func=lambda api, item: AsyncFeature(layer, data=item))
|
|
301
294
|
|
|
302
295
|
|
|
303
296
|
@classmethod
|
|
304
|
-
async def get_feature(cls, layer: 'VectorLayer', feature_id: int, user_id: int = None) -> '
|
|
297
|
+
async def get_feature(cls, layer: 'VectorLayer', feature_id: int, user_id: int = None) -> 'AsyncFeature':
|
|
305
298
|
"""
|
|
306
299
|
[async] Get a feature by its ID.
|
|
307
300
|
|
|
@@ -311,21 +304,21 @@ class Feature(AsyncBase):
|
|
|
311
304
|
user_id (int): specific user. privileges required.
|
|
312
305
|
|
|
313
306
|
Returns:
|
|
314
|
-
|
|
307
|
+
AsyncFeature: The retrieved feature instance
|
|
315
308
|
|
|
316
309
|
Example:
|
|
317
310
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
318
|
-
>>> from geobox.aio.feature import
|
|
311
|
+
>>> from geobox.aio.feature import AsyncFeature
|
|
319
312
|
>>> async with AsyncGeoboxClient() as client:
|
|
320
313
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
321
|
-
>>> feature = await
|
|
314
|
+
>>> feature = await AsyncFeature.get_feature(layer, feature_id=1)
|
|
322
315
|
"""
|
|
323
316
|
param = {
|
|
324
317
|
'f': 'json',
|
|
325
318
|
'user_id': user_id
|
|
326
319
|
}
|
|
327
320
|
endpoint = urljoin(layer.endpoint, f'features/')
|
|
328
|
-
return await cls._get_detail(layer.api, endpoint, uuid=feature_id, params=param, factory_func=lambda api, item:
|
|
321
|
+
return await cls._get_detail(layer.api, endpoint, uuid=feature_id, params=param, factory_func=lambda api, item: AsyncFeature(layer, data=item))
|
|
329
322
|
|
|
330
323
|
|
|
331
324
|
@property
|
|
@@ -344,7 +337,6 @@ class Feature(AsyncBase):
|
|
|
344
337
|
|
|
345
338
|
Example:
|
|
346
339
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
347
|
-
>>> from geobox.aio.feature import Feature
|
|
348
340
|
>>> async with AsyncGeoboxClient() as client:
|
|
349
341
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
350
342
|
>>> feature = await layer.get_feature(id=1)
|
|
@@ -395,7 +387,6 @@ class Feature(AsyncBase):
|
|
|
395
387
|
|
|
396
388
|
Example:
|
|
397
389
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
398
|
-
>>> from geobox.aio.feature import Feature
|
|
399
390
|
>>> from shapely.affinity import translate
|
|
400
391
|
>>> async with AsyncGeoboxClient() as client:
|
|
401
392
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
@@ -423,7 +414,7 @@ class Feature(AsyncBase):
|
|
|
423
414
|
self.data['geometry'] = mapping(value)
|
|
424
415
|
|
|
425
416
|
|
|
426
|
-
def transform(self, out_srid: int) -> '
|
|
417
|
+
def transform(self, out_srid: int) -> 'AsyncFeature':
|
|
427
418
|
"""
|
|
428
419
|
Transform the feature geometry to a new SRID.
|
|
429
420
|
|
|
@@ -431,7 +422,7 @@ class Feature(AsyncBase):
|
|
|
431
422
|
out_srid (int): The target SRID to transform the geometry to (e.g., 4326 for WGS84, 3857 for Web Mercator)
|
|
432
423
|
|
|
433
424
|
Returns:
|
|
434
|
-
|
|
425
|
+
AsyncFeature: A new Feature instance with transformed geometry.
|
|
435
426
|
|
|
436
427
|
Raises:
|
|
437
428
|
ValueError: If the feature has no geometry or if the transformation fails.
|
|
@@ -439,7 +430,6 @@ class Feature(AsyncBase):
|
|
|
439
430
|
|
|
440
431
|
Example:
|
|
441
432
|
>>> from geobox.aio import AsyncGeoboxClient
|
|
442
|
-
>>> from geobox.aio.feature import Feature
|
|
443
433
|
>>> async with AsyncGeoboxClient() as client:
|
|
444
434
|
>>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
445
435
|
>>> feature = await layer.get_feature(id=1, srid=3857)
|
|
@@ -502,15 +492,15 @@ class Feature(AsyncBase):
|
|
|
502
492
|
return self
|
|
503
493
|
|
|
504
494
|
|
|
505
|
-
def to_sync(self, sync_client: '
|
|
495
|
+
def to_sync(self, sync_client: 'GeoboxClient') -> 'Feature':
|
|
506
496
|
"""
|
|
507
497
|
[async] Switch to sync version of the feature instance to have access to the sync methods
|
|
508
498
|
|
|
509
499
|
Args:
|
|
510
|
-
sync_client (
|
|
500
|
+
sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
|
|
511
501
|
|
|
512
502
|
Returns:
|
|
513
|
-
|
|
503
|
+
Feature: the sync instance of the feature.
|
|
514
504
|
|
|
515
505
|
Example:
|
|
516
506
|
>>> from geobox import Geoboxclient
|
|
@@ -521,7 +511,7 @@ class Feature(AsyncBase):
|
|
|
521
511
|
>>> feature = await layer.get_feature(id=1, srid=3857)
|
|
522
512
|
>>> sync_feature = feature.to_sync(client)
|
|
523
513
|
"""
|
|
524
|
-
from ..feature import Feature
|
|
514
|
+
from ..feature import Feature
|
|
525
515
|
|
|
526
516
|
sync_layer = self.layer.to_sync(sync_client=sync_client)
|
|
527
|
-
return
|
|
517
|
+
return Feature(layer=sync_layer, srid=self.srid, data=self.data)
|