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/enums.py
CHANGED
|
@@ -399,4 +399,34 @@ class RangeBound(Enum):
|
|
|
399
399
|
|
|
400
400
|
class DistanceUnit(Enum):
|
|
401
401
|
GEO = 'GEO'
|
|
402
|
-
PIXEL = 'PIXEL'
|
|
402
|
+
PIXEL = 'PIXEL'
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class GroupByAggFunction(Enum):
|
|
406
|
+
COUNT = 'count'
|
|
407
|
+
SUM = 'sum'
|
|
408
|
+
MIN = 'min'
|
|
409
|
+
MAX = 'max'
|
|
410
|
+
AVG = 'avg'
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
class NetworkTraceDirection(Enum):
|
|
414
|
+
UP = "up"
|
|
415
|
+
DOWN = "down"
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class SpatialAggFunction(Enum):
|
|
419
|
+
COLLECT = 'collect'
|
|
420
|
+
UNION = 'union'
|
|
421
|
+
EXTENT = 'extent'
|
|
422
|
+
MAKELINE = 'makeline'
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
class SpatialPredicate(Enum):
|
|
426
|
+
INTERSECT = 'Intersect'
|
|
427
|
+
CONTAIN = 'Contain'
|
|
428
|
+
CROSS = 'Cross'
|
|
429
|
+
EQUAL = 'Equal'
|
|
430
|
+
OVERLAP = 'Overlap'
|
|
431
|
+
TOUCH = 'Touch'
|
|
432
|
+
WITHIN = 'Within'
|
geobox/feature.py
CHANGED
|
@@ -7,7 +7,7 @@ from .enums import FeatureType
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
8
8
|
from .vectorlayer import VectorLayer
|
|
9
9
|
from .aio import AsyncGeoboxClient
|
|
10
|
-
from .aio.feature import
|
|
10
|
+
from .aio.feature import AsyncFeature
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Feature(Base):
|
|
@@ -16,7 +16,7 @@ class Feature(Base):
|
|
|
16
16
|
|
|
17
17
|
def __init__(self,
|
|
18
18
|
layer: 'VectorLayer',
|
|
19
|
-
srid: Optional[int] =
|
|
19
|
+
srid: Optional[int] = BASE_SRID,
|
|
20
20
|
data: Optional[Dict] = {}):
|
|
21
21
|
"""
|
|
22
22
|
Constructs all the necessary attributes for the Feature object.
|
|
@@ -30,7 +30,17 @@ class Feature(Base):
|
|
|
30
30
|
>>> from geobox import GeoboxClient, Feature
|
|
31
31
|
>>> client = GeoboxClient()
|
|
32
32
|
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
33
|
-
>>>
|
|
33
|
+
>>> geojson = {
|
|
34
|
+
... "type": "Feature",
|
|
35
|
+
... "geometry": {
|
|
36
|
+
... "type": "Point",
|
|
37
|
+
... "coordinates": [58.4, 23.6]
|
|
38
|
+
... },
|
|
39
|
+
... "properties": {
|
|
40
|
+
... "name": "Test feature"
|
|
41
|
+
... }
|
|
42
|
+
... }
|
|
43
|
+
>>> feature = Feature(layer=layer, data=geojson, srid=4326) # example srid set to 4326
|
|
34
44
|
>>> feature.save()
|
|
35
45
|
"""
|
|
36
46
|
super().__init__(api=layer.api)
|
|
@@ -65,8 +75,9 @@ class Feature(Base):
|
|
|
65
75
|
Returns:
|
|
66
76
|
str: A string representation of the Feature object.
|
|
67
77
|
"""
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
feature_id = getattr(self, "id", "-1")
|
|
79
|
+
return f"Feature(id={feature_id}, type={self.feature_type})"
|
|
80
|
+
|
|
70
81
|
|
|
71
82
|
def __getattr__(self, name: str) -> Any:
|
|
72
83
|
"""
|
|
@@ -217,18 +228,28 @@ class Feature(Base):
|
|
|
217
228
|
>>> feature.save()
|
|
218
229
|
"""
|
|
219
230
|
data = self.data.copy()
|
|
231
|
+
srid = self.srid
|
|
232
|
+
|
|
220
233
|
try:
|
|
221
234
|
if self.id:
|
|
222
235
|
if self.srid != self.BASE_SRID:
|
|
223
|
-
self
|
|
236
|
+
self = self.transform(self.BASE_SRID)
|
|
237
|
+
self.data['geometry'] = self.original_geometry
|
|
224
238
|
self.update(self.data)
|
|
225
239
|
self.coordinates = data['geometry']['coordinates']
|
|
226
240
|
except AttributeError:
|
|
241
|
+
if self.srid != self.BASE_SRID:
|
|
242
|
+
self = self.transform(self.BASE_SRID)
|
|
227
243
|
endpoint = urljoin(self.layer.endpoint, 'features/')
|
|
228
|
-
|
|
244
|
+
request_data = self.data.copy()
|
|
245
|
+
response = self.layer.api.post(endpoint, request_data)
|
|
229
246
|
self.endpoint = urljoin(self.layer.endpoint, f'features/{response["id"]}/')
|
|
230
247
|
self.data.update(response)
|
|
231
248
|
|
|
249
|
+
self.data['geometry'] = data['geometry']
|
|
250
|
+
self._srid = srid
|
|
251
|
+
|
|
252
|
+
|
|
232
253
|
|
|
233
254
|
def delete(self) -> None:
|
|
234
255
|
"""
|
|
@@ -244,7 +265,7 @@ class Feature(Base):
|
|
|
244
265
|
>>> feature = layer.get_feature(id=1)
|
|
245
266
|
>>> feature.delete()
|
|
246
267
|
"""
|
|
247
|
-
super().
|
|
268
|
+
super()._delete(self.endpoint)
|
|
248
269
|
|
|
249
270
|
|
|
250
271
|
def update(self, geojson: Dict) -> Dict:
|
|
@@ -511,7 +532,7 @@ class Feature(Base):
|
|
|
511
532
|
async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
|
|
512
533
|
|
|
513
534
|
Returns:
|
|
514
|
-
|
|
535
|
+
AsyncFeature: the async instance of the feature.
|
|
515
536
|
|
|
516
537
|
Example:
|
|
517
538
|
>>> from geobox import Geoboxclient
|
|
@@ -522,7 +543,7 @@ class Feature(Base):
|
|
|
522
543
|
>>> async with AsyncGeoboxClient() as async_client:
|
|
523
544
|
>>> async_feature = feature.to_async(async_client)
|
|
524
545
|
"""
|
|
525
|
-
from .aio.feature import
|
|
546
|
+
from .aio.feature import AsyncFeature
|
|
526
547
|
|
|
527
548
|
async_layer = self.layer.to_async(async_client=async_client)
|
|
528
549
|
return AsyncFeature(layer=async_layer, srid=self.srid, data=self.data)
|