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.
Files changed (70) hide show
  1. geobox/__init__.py +61 -63
  2. geobox/aio/__init__.py +61 -63
  3. geobox/aio/api.py +489 -473
  4. geobox/aio/apikey.py +263 -263
  5. geobox/aio/attachment.py +341 -339
  6. geobox/aio/base.py +261 -262
  7. geobox/aio/basemap.py +196 -196
  8. geobox/aio/dashboard.py +340 -342
  9. geobox/aio/feature.py +23 -33
  10. geobox/aio/field.py +315 -321
  11. geobox/aio/file.py +72 -72
  12. geobox/aio/layout.py +340 -341
  13. geobox/aio/log.py +23 -23
  14. geobox/aio/map.py +1033 -1034
  15. geobox/aio/model3d.py +415 -415
  16. geobox/aio/mosaic.py +696 -696
  17. geobox/aio/plan.py +314 -314
  18. geobox/aio/query.py +693 -693
  19. geobox/aio/raster.py +907 -869
  20. geobox/aio/raster_analysis.py +740 -0
  21. geobox/aio/route.py +4 -4
  22. geobox/aio/scene.py +340 -342
  23. geobox/aio/settings.py +18 -18
  24. geobox/aio/task.py +404 -402
  25. geobox/aio/tile3d.py +337 -339
  26. geobox/aio/tileset.py +102 -103
  27. geobox/aio/usage.py +52 -51
  28. geobox/aio/user.py +506 -507
  29. geobox/aio/vector_tool.py +1968 -0
  30. geobox/aio/vectorlayer.py +315 -306
  31. geobox/aio/version.py +272 -273
  32. geobox/aio/view.py +1019 -983
  33. geobox/aio/workflow.py +340 -341
  34. geobox/api.py +18 -2
  35. geobox/apikey.py +262 -262
  36. geobox/attachment.py +336 -337
  37. geobox/base.py +384 -384
  38. geobox/basemap.py +194 -194
  39. geobox/dashboard.py +339 -341
  40. geobox/enums.py +432 -348
  41. geobox/feature.py +5 -5
  42. geobox/field.py +320 -320
  43. geobox/file.py +4 -4
  44. geobox/layout.py +339 -340
  45. geobox/log.py +4 -4
  46. geobox/map.py +1031 -1032
  47. geobox/model3d.py +410 -410
  48. geobox/mosaic.py +696 -696
  49. geobox/plan.py +313 -313
  50. geobox/query.py +691 -691
  51. geobox/raster.py +907 -863
  52. geobox/raster_analysis.py +737 -0
  53. geobox/scene.py +341 -342
  54. geobox/settings.py +194 -194
  55. geobox/task.py +399 -400
  56. geobox/tile3d.py +337 -338
  57. geobox/tileset.py +4 -4
  58. geobox/usage.py +3 -3
  59. geobox/user.py +503 -503
  60. geobox/vector_tool.py +1968 -0
  61. geobox/vectorlayer.py +5 -5
  62. geobox/version.py +272 -272
  63. geobox/view.py +981 -981
  64. geobox/workflow.py +338 -339
  65. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
  66. geobox-2.2.0.dist-info/RECORD +72 -0
  67. geobox-2.0.1.dist-info/RECORD +0 -68
  68. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
  69. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
  70. {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 as SyncGeoboxClient
10
- from ..feature import Feature as SyncFeature
9
+ from ..api import GeoboxClient
10
+ from ..feature import Feature
11
11
 
12
12
 
13
- class Feature(AsyncBase):
13
+ class AsyncFeature(AsyncBase):
14
14
 
15
15
  BASE_SRID = 3857
16
16
 
17
17
  def __init__(self,
18
- layer: 'VectorLayer',
19
- srid: Optional[int] = 3857,
20
- data: Optional[Dict] = {}):
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"Feature(id={self.id}, type={self.feature_type})"
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().delete(self.endpoint)
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) -> 'Feature':
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
- Feature: The created feature instance
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: Feature(layer, data=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) -> 'Feature':
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
- Feature: The retrieved feature instance
307
+ AsyncFeature: The retrieved feature instance
315
308
 
316
309
  Example:
317
310
  >>> from geobox.aio import AsyncGeoboxClient
318
- >>> from geobox.aio.feature import Feature
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 Feature.get_feature(layer, feature_id=1)
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: Feature(layer, data=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) -> 'Feature':
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
- Feature: A new Feature instance with transformed geometry.
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: 'SyncGeoboxClient') -> 'SyncFeature':
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 (SyncGeoboxClient): The sync version of the GeoboxClient instance for making requests.
500
+ sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
511
501
 
512
502
  Returns:
513
- geobox.feature.Feature: the sync instance of the feature.
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 as SyncFeature
514
+ from ..feature import Feature
525
515
 
526
516
  sync_layer = self.layer.to_sync(sync_client=sync_client)
527
- return SyncFeature(layer=sync_layer, srid=self.srid, data=self.data)
517
+ return Feature(layer=sync_layer, srid=self.srid, data=self.data)