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
|
@@ -14,30 +14,25 @@ if TYPE_CHECKING:
|
|
|
14
14
|
from . import GeoboxClient
|
|
15
15
|
from .task import Task
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class RasterAnalysis(Base):
|
|
18
18
|
|
|
19
19
|
BASE_ENDPOINT = 'analysis/'
|
|
20
20
|
|
|
21
|
-
def __init__(self,
|
|
22
|
-
api: 'GeoboxClient',
|
|
23
|
-
data: Optional[Dict] = {}):
|
|
21
|
+
def __init__(self, api: 'GeoboxClient'):
|
|
24
22
|
"""
|
|
25
|
-
Initialize a
|
|
23
|
+
Initialize a RasterAnalysis instance.
|
|
26
24
|
|
|
27
25
|
Args:
|
|
28
26
|
api (GeoboxClient): The GeoboxClient instance for making requests.
|
|
29
|
-
uuid (str): The unique identifier for the workflow.
|
|
30
|
-
data (Dict): The response data of the workflow.
|
|
31
27
|
"""
|
|
32
|
-
super().__init__(api
|
|
28
|
+
super().__init__(api)
|
|
33
29
|
|
|
34
30
|
|
|
35
31
|
def __repr__(self) -> str:
|
|
36
|
-
return f"
|
|
32
|
+
return f"RasterAnalysis()"
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
def rasterize(
|
|
40
|
-
api: 'GeoboxClient',
|
|
34
|
+
|
|
35
|
+
def rasterize(self,
|
|
41
36
|
layer: Union[VectorLayer, VectorLayerView],
|
|
42
37
|
output_raster_name: str,
|
|
43
38
|
pixel_size: int = 10,
|
|
@@ -54,7 +49,6 @@ class Analysis(Base):
|
|
|
54
49
|
Only users with Publisher role or higher can perform this operation.
|
|
55
50
|
|
|
56
51
|
Args:
|
|
57
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
58
52
|
layer (VectorLayer | VectorLayerView): VectorLayer or VectorLayerView instance
|
|
59
53
|
output_raster_name (str): Name for the output raster dataset
|
|
60
54
|
pixel_size (int, optional): Pixel size for the output raster (must be > 0). default: 10
|
|
@@ -69,17 +63,18 @@ class Analysis(Base):
|
|
|
69
63
|
|
|
70
64
|
Example:
|
|
71
65
|
>>> from geobox import GeoboxClient
|
|
72
|
-
>>> from geobox.raster_analysis import
|
|
66
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
73
67
|
>>> client = GeoboxClient()
|
|
74
68
|
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
75
|
-
>>> task =
|
|
69
|
+
>>> task = client.raster_analysis.rasterize(layer=vector, output_raster_name='test')
|
|
76
70
|
or
|
|
77
|
-
>>>
|
|
71
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
72
|
+
>>> task = raster_analysis.rasterize(layer=vector, output_raster_name='test')
|
|
78
73
|
"""
|
|
79
74
|
if not isinstance(layer, VectorLayer) and not isinstance(layer, VectorLayerView):
|
|
80
75
|
raise ValueError("'layer' input only accepts vector layer and view objects!")
|
|
81
76
|
|
|
82
|
-
endpoint = f'{
|
|
77
|
+
endpoint = f'{self.BASE_ENDPOINT}rasterize/'
|
|
83
78
|
|
|
84
79
|
data = clean_data({
|
|
85
80
|
'layer_uuid': layer.uuid,
|
|
@@ -93,13 +88,11 @@ class Analysis(Base):
|
|
|
93
88
|
'user_id': user_id
|
|
94
89
|
})
|
|
95
90
|
|
|
96
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
97
|
-
return api.get_task(response['task_id'])
|
|
91
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
92
|
+
return self.api.get_task(response['task_id'])
|
|
98
93
|
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
def polygonize(cls,
|
|
102
|
-
api: 'GeoboxClient',
|
|
95
|
+
def polygonize(self,
|
|
103
96
|
raster: 'Raster',
|
|
104
97
|
output_layer_name: str,
|
|
105
98
|
band_index: int = 1,
|
|
@@ -115,7 +108,6 @@ class Analysis(Base):
|
|
|
115
108
|
vectorizes a raster (polygonize) to a vector dataset (*.gpkg). Only users with Publisher role or higher can perform this operation
|
|
116
109
|
|
|
117
110
|
Args:
|
|
118
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
119
111
|
raster (Raster): Raster instance
|
|
120
112
|
output_layer_name (str): Name for the output vector layer.
|
|
121
113
|
band_index (int, optional): Raster band to polygonize. default: 1
|
|
@@ -131,14 +123,15 @@ class Analysis(Base):
|
|
|
131
123
|
|
|
132
124
|
Example:
|
|
133
125
|
>>> from geobox import GeoboxClient
|
|
134
|
-
>>> from geobox.raster_analysis import
|
|
126
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
135
127
|
>>> client = GeoboxClient()
|
|
136
128
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
137
|
-
>>> task =
|
|
129
|
+
>>> task = client.raster_analysis.polygonize(raster=raster, output_layer_name='test')
|
|
138
130
|
or
|
|
139
|
-
>>>
|
|
131
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
132
|
+
>>> task = raster_analysis.polygonize(raster=raster, output_layer_name='test')
|
|
140
133
|
"""
|
|
141
|
-
endpoint = f'{
|
|
134
|
+
endpoint = f'{self.BASE_ENDPOINT}polygonize/'
|
|
142
135
|
|
|
143
136
|
data = clean_data({
|
|
144
137
|
'raster_uuid': raster.uuid,
|
|
@@ -152,13 +145,11 @@ class Analysis(Base):
|
|
|
152
145
|
'user_id': user_id
|
|
153
146
|
})
|
|
154
147
|
|
|
155
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
156
|
-
return api.get_task(response['task_id'])
|
|
148
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
149
|
+
return self.api.get_task(response['task_id'])
|
|
157
150
|
|
|
158
151
|
|
|
159
|
-
|
|
160
|
-
def clip(cls,
|
|
161
|
-
api: 'GeoboxClient',
|
|
152
|
+
def clip(self,
|
|
162
153
|
raster: 'Raster',
|
|
163
154
|
layer: Union[VectorLayer, VectorLayerView],
|
|
164
155
|
output_raster_name: str,
|
|
@@ -173,7 +164,6 @@ class Analysis(Base):
|
|
|
173
164
|
clips a raster dataset using a vector layer as the clipping boundary. Only users with Publisher role or higher can perform this operation
|
|
174
165
|
|
|
175
166
|
Args:
|
|
176
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
177
167
|
raster (Raster): Raster instance
|
|
178
168
|
layer (VectorLayer | VectorLayerView): VectorLayer or VectorLayerView instance
|
|
179
169
|
output_raster_name (str): Name for the output raster dataset
|
|
@@ -188,18 +178,19 @@ class Analysis(Base):
|
|
|
188
178
|
|
|
189
179
|
Example:
|
|
190
180
|
>>> from geobox import GeoboxClient
|
|
191
|
-
>>> from geobox.raster_analysis import
|
|
181
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
192
182
|
>>> client = GeoboxClient()
|
|
193
183
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
194
184
|
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
195
|
-
>>> task =
|
|
185
|
+
>>> task = client.raster_analysis.clip(layer=vector, output_raster_name='test')
|
|
196
186
|
or
|
|
197
|
-
>>>
|
|
187
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
188
|
+
>>> task = raster_analysis.clip(raster=raster, layer=vector, output_raster_name='test')
|
|
198
189
|
"""
|
|
199
190
|
if not isinstance(layer, VectorLayer) and not isinstance(layer, VectorLayerView):
|
|
200
191
|
raise ValueError("'layer' input only accepts vector layer and view objects!")
|
|
201
192
|
|
|
202
|
-
endpoint = f'{
|
|
193
|
+
endpoint = f'{self.BASE_ENDPOINT}clip/'
|
|
203
194
|
|
|
204
195
|
data = clean_data({
|
|
205
196
|
'raster_uuid': raster.uuid,
|
|
@@ -213,13 +204,11 @@ class Analysis(Base):
|
|
|
213
204
|
'user_id': user_id
|
|
214
205
|
})
|
|
215
206
|
|
|
216
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
217
|
-
return api.get_task(response['task_id'])
|
|
207
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
208
|
+
return self.api.get_task(response['task_id'])
|
|
218
209
|
|
|
219
210
|
|
|
220
|
-
|
|
221
|
-
def calculator(cls,
|
|
222
|
-
api: 'GeoboxClient',
|
|
211
|
+
def calculator(self,
|
|
223
212
|
variables: str,
|
|
224
213
|
expr: str,
|
|
225
214
|
output_raster_name: str,
|
|
@@ -240,7 +229,6 @@ class Analysis(Base):
|
|
|
240
229
|
Multi-band operations: variables='{"IMG": ["raster_uuid_1", 2]}', expr="IMG*2"
|
|
241
230
|
|
|
242
231
|
Args:
|
|
243
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
244
232
|
variables (str): JSON string mapping variable names to raster specifications. Format: '{"NIR": "raster_uuid_1", "RED": "raster_uuid_2"}' or '{"IMG": ["raster_uuid_1", 2]}' for multi-band operations.
|
|
245
233
|
expr (str): Mathematical expression using NumPy syntax. Use variable names from the variables dict, e.g., '(NIR-RED)/(NIR+RED)' or 'where(SLOPE>30,1,0)' or 'where((dist_to_highway < 1000) & (slope < 10), 1, 0)' .Supported functions: np, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, log10, sqrt, abs, floor, ceil, round, minimum, maximum, clip, where, isnan, isfinite, pi, e.
|
|
246
234
|
output_raster_name (str): Name for the output raster dataset.
|
|
@@ -255,14 +243,19 @@ class Analysis(Base):
|
|
|
255
243
|
|
|
256
244
|
Example:
|
|
257
245
|
>>> from geobox import GeoboxClient
|
|
258
|
-
>>> from geobox.raster_analysis import
|
|
246
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
259
247
|
>>> client = GeoboxClient()
|
|
260
248
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
261
|
-
>>> task =
|
|
249
|
+
>>> task = client.raster_analysis.calculator(variables={"NIR": "raster_uuid_1", "RED": "raster_uuid_2"},
|
|
250
|
+
... expr='where(SLOPE>30,1,0)',
|
|
251
|
+
... output_raster_name='test')
|
|
252
|
+
or
|
|
253
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
254
|
+
>>> task = raster_analysis.raster_analysis.calculator(variables={"NIR": "raster_uuid_1", "RED": "raster_uuid_2"},
|
|
262
255
|
... expr='where(SLOPE>30,1,0)',
|
|
263
256
|
... output_raster_name='test')
|
|
264
257
|
"""
|
|
265
|
-
endpoint = f'{
|
|
258
|
+
endpoint = f'{self.BASE_ENDPOINT}calculator/'
|
|
266
259
|
|
|
267
260
|
data = clean_data({
|
|
268
261
|
'variables': variables,
|
|
@@ -275,13 +268,11 @@ class Analysis(Base):
|
|
|
275
268
|
'user_id': user_id
|
|
276
269
|
})
|
|
277
270
|
|
|
278
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
279
|
-
return api.get_task(response['task_id'])
|
|
271
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
272
|
+
return self.api.get_task(response['task_id'])
|
|
280
273
|
|
|
281
274
|
|
|
282
|
-
|
|
283
|
-
def slope(cls,
|
|
284
|
-
api: 'GeoboxClient',
|
|
275
|
+
def slope(self,
|
|
285
276
|
raster: 'Raster',
|
|
286
277
|
output_raster_name: str,
|
|
287
278
|
slope_units: SlopeUnit = SlopeUnit.degree,
|
|
@@ -296,7 +287,6 @@ class Analysis(Base):
|
|
|
296
287
|
This endpoint creates a slope raster from a Digital Elevation Model (DEM). Only users with Publisher role or higher can perform this operation.
|
|
297
288
|
|
|
298
289
|
Args:
|
|
299
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
300
290
|
raster (Raster): DEM Raster instance
|
|
301
291
|
output_raster_name (str): Name for the output raster dataset.
|
|
302
292
|
slope_units (SlopeUnit, optional): Slope units: 'degree' or 'percent'. default: SlopeUnit.degree
|
|
@@ -311,14 +301,15 @@ class Analysis(Base):
|
|
|
311
301
|
|
|
312
302
|
Example:
|
|
313
303
|
>>> from geobox import GeoboxClient
|
|
314
|
-
>>> from geobox.raster_analysis import
|
|
304
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
315
305
|
>>> client = GeoboxClient()
|
|
316
306
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
317
|
-
>>> task =
|
|
307
|
+
>>> task = client.raster_analysis.slope(raster=raster, output_raster_name='test')
|
|
318
308
|
or
|
|
319
|
-
>>>
|
|
309
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
310
|
+
>>> task = raster_analysis.slope(raster=raster, output_raster_name='test')
|
|
320
311
|
"""
|
|
321
|
-
endpoint = f'{
|
|
312
|
+
endpoint = f'{self.BASE_ENDPOINT}slope/'
|
|
322
313
|
|
|
323
314
|
data = clean_data({
|
|
324
315
|
'raster_uuid': raster.uuid,
|
|
@@ -331,13 +322,11 @@ class Analysis(Base):
|
|
|
331
322
|
'user_id': user_id
|
|
332
323
|
})
|
|
333
324
|
|
|
334
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
335
|
-
return api.get_task(response['task_id'])
|
|
325
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
326
|
+
return self.api.get_task(response['task_id'])
|
|
336
327
|
|
|
337
328
|
|
|
338
|
-
|
|
339
|
-
def aspect(cls,
|
|
340
|
-
api: 'GeoboxClient',
|
|
329
|
+
def aspect(self,
|
|
341
330
|
raster: 'Raster',
|
|
342
331
|
output_raster_name: str,
|
|
343
332
|
algorithm: AnalysisAlgorithm = AnalysisAlgorithm.Horn,
|
|
@@ -353,7 +342,6 @@ class Analysis(Base):
|
|
|
353
342
|
Only users with Publisher role or higher can perform this operation.
|
|
354
343
|
|
|
355
344
|
Args:
|
|
356
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
357
345
|
raster (Raster): DEM Raster instance
|
|
358
346
|
output_raster_name (str): Name for the output raster dataset.
|
|
359
347
|
algorithm (AnalysisAlgorithm, optional): Algorithm: 'Horn' or 'ZevenbergenThorne'. default: AnalysisAlgorithm.Horn
|
|
@@ -368,15 +356,17 @@ class Analysis(Base):
|
|
|
368
356
|
|
|
369
357
|
Example:
|
|
370
358
|
>>> from geobox import GeoboxClient
|
|
371
|
-
>>> from geobox.raster_analysis import
|
|
359
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
360
|
+
|
|
372
361
|
>>> client = GeoboxClient()
|
|
373
362
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
374
|
-
>>> task =
|
|
363
|
+
>>> task = cient.raster_analysis.aspect(raster=raster, output_raster_name='test')
|
|
375
364
|
or
|
|
376
|
-
>>>
|
|
365
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
366
|
+
>>> task = raster_analysis.aspect(raster=raster, output_raster_name='test')
|
|
377
367
|
"""
|
|
378
368
|
|
|
379
|
-
endpoint = f'{
|
|
369
|
+
endpoint = f'{self.BASE_ENDPOINT}aspect/'
|
|
380
370
|
|
|
381
371
|
data = clean_data({
|
|
382
372
|
'raster_uuid': raster.uuid,
|
|
@@ -389,13 +379,11 @@ class Analysis(Base):
|
|
|
389
379
|
'user_id': user_id
|
|
390
380
|
})
|
|
391
381
|
|
|
392
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
393
|
-
return api.get_task(response['task_id'])
|
|
382
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
383
|
+
return self.api.get_task(response['task_id'])
|
|
394
384
|
|
|
395
385
|
|
|
396
|
-
|
|
397
|
-
def reclassify(cls,
|
|
398
|
-
api: 'GeoboxClient',
|
|
386
|
+
def reclassify(self,
|
|
399
387
|
raster: 'Raster',
|
|
400
388
|
output_raster_name: str,
|
|
401
389
|
rules: str,
|
|
@@ -412,7 +400,6 @@ class Analysis(Base):
|
|
|
412
400
|
Only users with Publisher role or higher can perform this operation.
|
|
413
401
|
|
|
414
402
|
Args:
|
|
415
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
416
403
|
raster (Raster): Raster instance
|
|
417
404
|
output_raster_name (str): Name for the output reclassified raster dataset.
|
|
418
405
|
rules (str): JSON string containing reclassification rules.
|
|
@@ -433,14 +420,15 @@ class Analysis(Base):
|
|
|
433
420
|
|
|
434
421
|
Example:
|
|
435
422
|
>>> from geobox import GeoboxClient
|
|
436
|
-
>>> from geobox.raster_analysis import
|
|
423
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
437
424
|
>>> client = GeoboxClient()
|
|
438
425
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
439
|
-
>>> task =
|
|
426
|
+
>>> task = client.raster_analysis.reclassify(raster=raster, output_raster_name='test', rules='{"1": 10, "2": 20, "3": 30}')
|
|
440
427
|
or
|
|
441
|
-
>>>
|
|
428
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
429
|
+
>>> task = raster_analysis.reclassify(raster=raster, output_raster_name='test', rules='{"1": 10, "2": 20, "3": 30}')
|
|
442
430
|
"""
|
|
443
|
-
endpoint = f'{
|
|
431
|
+
endpoint = f'{self.BASE_ENDPOINT}reclassify/'
|
|
444
432
|
|
|
445
433
|
data = clean_data({
|
|
446
434
|
'raster_uuid': raster.uuid,
|
|
@@ -455,13 +443,11 @@ class Analysis(Base):
|
|
|
455
443
|
'user_id': user_id
|
|
456
444
|
})
|
|
457
445
|
|
|
458
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
459
|
-
return api.get_task(response['task_id'])
|
|
446
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
447
|
+
return self.api.get_task(response['task_id'])
|
|
460
448
|
|
|
461
449
|
|
|
462
|
-
|
|
463
|
-
def resample(cls,
|
|
464
|
-
api: 'GeoboxClient',
|
|
450
|
+
def resample(self,
|
|
465
451
|
raster: 'Raster',
|
|
466
452
|
output_raster_name: str,
|
|
467
453
|
out_res: Optional[str] = None,
|
|
@@ -478,7 +464,6 @@ class Analysis(Base):
|
|
|
478
464
|
Only users with Publisher role or higher can perform this operation.
|
|
479
465
|
|
|
480
466
|
Args:
|
|
481
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
482
467
|
raster (Raster): Raster instance
|
|
483
468
|
output_raster_name (str): Name for the output reclassified raster dataset.
|
|
484
469
|
out_res (str, optional): Output resolution as 'x_res,y_res' (e.g., '10,10').
|
|
@@ -493,17 +478,18 @@ class Analysis(Base):
|
|
|
493
478
|
|
|
494
479
|
Example:
|
|
495
480
|
>>> from geobox import GeoboxClient
|
|
496
|
-
>>> from geobox.raster_analysis import
|
|
481
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
497
482
|
>>> client = GeoboxClient()
|
|
498
483
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
499
|
-
>>> task =
|
|
484
|
+
>>> task = client.raster_analysis.resample(raster=raster, output_raster_name='test', out_res='10,10')
|
|
500
485
|
or
|
|
501
|
-
>>>
|
|
486
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
487
|
+
>>> task = raster_analysis.resample(raster=raster, output_raster_name='test', out_res='10,10')
|
|
502
488
|
"""
|
|
503
489
|
if sum(x is not None for x in [out_res, scale_factor, match_raster_uuid]) != 1:
|
|
504
490
|
raise ValueError('Exactly one of out_res, scale_factor, or match_raster_uuid must be provided!')
|
|
505
491
|
|
|
506
|
-
endpoint = f'{
|
|
492
|
+
endpoint = f'{self.BASE_ENDPOINT}resample/'
|
|
507
493
|
|
|
508
494
|
data = clean_data({
|
|
509
495
|
'raster_uuid': raster.uuid,
|
|
@@ -516,13 +502,11 @@ class Analysis(Base):
|
|
|
516
502
|
'user_id': user_id
|
|
517
503
|
})
|
|
518
504
|
|
|
519
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
520
|
-
return api.get_task(response['task_id'])
|
|
505
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
506
|
+
return self.api.get_task(response['task_id'])
|
|
521
507
|
|
|
522
508
|
|
|
523
|
-
|
|
524
|
-
def idw_interpolation(cls,
|
|
525
|
-
api: 'GeoboxClient',
|
|
509
|
+
def idw_interpolation(self,
|
|
526
510
|
layer: Union[VectorLayer, VectorLayerView],
|
|
527
511
|
output_raster_name: str,
|
|
528
512
|
z_field: Field,
|
|
@@ -543,7 +527,6 @@ class Analysis(Base):
|
|
|
543
527
|
Only users with Publisher role or higher can perform this operation.
|
|
544
528
|
|
|
545
529
|
Args:
|
|
546
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
547
530
|
layer (VectorLayer | VectorLayerview): layer containing point data
|
|
548
531
|
output_raster_name (str): Name for the output IDW raster dataset.
|
|
549
532
|
z_field (Field): the field containing the values to interpolate.
|
|
@@ -563,15 +546,16 @@ class Analysis(Base):
|
|
|
563
546
|
|
|
564
547
|
Example:
|
|
565
548
|
>>> from geobox import GeoboxClient
|
|
566
|
-
>>> from geobox.raster_analysis import
|
|
549
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
567
550
|
>>> client = GeoboxClient()
|
|
568
551
|
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
|
569
552
|
>>> field = vector.get_field_by_name('field_name')
|
|
570
|
-
>>> task =
|
|
553
|
+
>>> task = client.raster_analysis.idw_interpolation(layer=vector, output_raster_name='test', z_field=field)
|
|
571
554
|
or
|
|
572
|
-
>>>
|
|
555
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
556
|
+
>>> task = raster_analysis.idw_interpolation(layer=vector, output_raster_name='test', z_field=field)
|
|
573
557
|
"""
|
|
574
|
-
endpoint = f'{
|
|
558
|
+
endpoint = f'{self.BASE_ENDPOINT}idw/'
|
|
575
559
|
|
|
576
560
|
data = clean_data({
|
|
577
561
|
'layer_uuid': layer.uuid,
|
|
@@ -590,13 +574,11 @@ class Analysis(Base):
|
|
|
590
574
|
'user_id': user_id
|
|
591
575
|
})
|
|
592
576
|
|
|
593
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
594
|
-
return api.get_task(response['task_id'])
|
|
577
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
578
|
+
return self.api.get_task(response['task_id'])
|
|
595
579
|
|
|
596
580
|
|
|
597
|
-
|
|
598
|
-
def constant(cls,
|
|
599
|
-
api: 'GeoboxClient',
|
|
581
|
+
def constant(self,
|
|
600
582
|
output_raster_name: str,
|
|
601
583
|
extent: str,
|
|
602
584
|
value : int,
|
|
@@ -608,11 +590,10 @@ class Analysis(Base):
|
|
|
608
590
|
"""
|
|
609
591
|
Create a raster filled with a constant value.
|
|
610
592
|
|
|
611
|
-
|
|
593
|
+
It creates a north-up GeoTIFF filled with a constant value.
|
|
612
594
|
Only users with Publisher role or higher can perform this operation.
|
|
613
595
|
|
|
614
596
|
Args:
|
|
615
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
616
597
|
output_raster_name (str): Name for the output constant raster dataset.
|
|
617
598
|
extent (str): Extent as 'minX,minY,maxX,maxY' (e.g., '0,0,100,100').
|
|
618
599
|
value (int): Constant value to fill the raster with.
|
|
@@ -627,11 +608,14 @@ class Analysis(Base):
|
|
|
627
608
|
|
|
628
609
|
Example:
|
|
629
610
|
>>> from geobox import GeoboxClient
|
|
630
|
-
>>> from geobox.raster_analysis import
|
|
611
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
631
612
|
>>> client = GeoboxClient()
|
|
632
|
-
>>> task =
|
|
613
|
+
>>> task = client.raster_analysis.constant(output_raster_name='test', extent='0,0,100,100', value=10)
|
|
614
|
+
or
|
|
615
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
616
|
+
>>> task = raster_analysis.constant(output_raster_name='test', extent='0,0,100,100', value=10)
|
|
633
617
|
"""
|
|
634
|
-
endpoint = f'{
|
|
618
|
+
endpoint = f'{self.BASE_ENDPOINT}constant/'
|
|
635
619
|
|
|
636
620
|
data = clean_data({
|
|
637
621
|
'output_raster_name': output_raster_name,
|
|
@@ -644,13 +628,11 @@ class Analysis(Base):
|
|
|
644
628
|
'user_id': user_id
|
|
645
629
|
})
|
|
646
630
|
|
|
647
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
648
|
-
return api.get_task(response['task_id'])
|
|
631
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
632
|
+
return self.api.get_task(response['task_id'])
|
|
649
633
|
|
|
650
634
|
|
|
651
|
-
|
|
652
|
-
def fill_nodata(cls,
|
|
653
|
-
api: 'GeoboxClient',
|
|
635
|
+
def fill_nodata(self,
|
|
654
636
|
raster: 'Raster',
|
|
655
637
|
output_raster_name: str,
|
|
656
638
|
band: Union[int, str] = 1,
|
|
@@ -667,7 +649,6 @@ class Analysis(Base):
|
|
|
667
649
|
Only users with Publisher role or higher can perform this operation.
|
|
668
650
|
|
|
669
651
|
Args:
|
|
670
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
671
652
|
raster (Raster): the input raster to fill NoData regions in
|
|
672
653
|
output_raster_name (str): Name for the output filled raster dataset.
|
|
673
654
|
band (int | str): 1-based band index to process or 'all' to process all bands. default: 1
|
|
@@ -682,14 +663,15 @@ class Analysis(Base):
|
|
|
682
663
|
|
|
683
664
|
Example:
|
|
684
665
|
>>> from geobox import GeoboxClient
|
|
685
|
-
>>> from geobox.raster_analysis import
|
|
666
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
686
667
|
>>> client = GeoboxClient()
|
|
687
668
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
688
|
-
>>> task =
|
|
669
|
+
>>> task = client.raster_analysis.fill_nodata(raster=raster, output_raster_name='test')
|
|
689
670
|
or
|
|
690
|
-
>>>
|
|
671
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
672
|
+
>>> task = raster_analysis.fill_nodata(raster=raster, output_raster_name='test')
|
|
691
673
|
"""
|
|
692
|
-
endpoint = f'{
|
|
674
|
+
endpoint = f'{self.BASE_ENDPOINT}fill/'
|
|
693
675
|
|
|
694
676
|
data = clean_data({
|
|
695
677
|
'raster_uuid': raster.uuid,
|
|
@@ -702,13 +684,11 @@ class Analysis(Base):
|
|
|
702
684
|
'user_id': user_id
|
|
703
685
|
})
|
|
704
686
|
|
|
705
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
706
|
-
return api.get_task(response['task_id'])
|
|
687
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
688
|
+
return self.api.get_task(response['task_id'])
|
|
707
689
|
|
|
708
690
|
|
|
709
|
-
|
|
710
|
-
def proximity(cls,
|
|
711
|
-
api: 'GeoboxClient',
|
|
691
|
+
def proximity(self,
|
|
712
692
|
raster: 'Raster',
|
|
713
693
|
output_raster_name: str,
|
|
714
694
|
dist_units: DistanceUnit = DistanceUnit.GEO,
|
|
@@ -722,7 +702,6 @@ class Analysis(Base):
|
|
|
722
702
|
Only users with Publisher role or higher can perform this operation.
|
|
723
703
|
|
|
724
704
|
Args:
|
|
725
|
-
api (GeoboxClient): The GeoboxClient instance for making requests
|
|
726
705
|
raster (Raster): the raster layer to create proximity raster from.
|
|
727
706
|
output_raster_name (str): Name for the output proximity raster dataset.
|
|
728
707
|
dist_units (DistanceUnit, optional): Distance units: 'GEO' for georeferenced units, 'PIXEL' for pixels. default: DistanceUnit.GEO
|
|
@@ -735,14 +714,15 @@ class Analysis(Base):
|
|
|
735
714
|
|
|
736
715
|
Example:
|
|
737
716
|
>>> from geobox import GeoboxClient
|
|
738
|
-
>>> from geobox.raster_analysis import
|
|
717
|
+
>>> from geobox.raster_analysis import RasterAnalysis
|
|
739
718
|
>>> client = GeoboxClient()
|
|
740
719
|
>>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
|
|
741
|
-
>>> task =
|
|
720
|
+
>>> task = client.raster_analysis.proximity(raster=raster, output_raster_name='test')
|
|
742
721
|
or
|
|
743
|
-
>>>
|
|
722
|
+
>>> raster_analysis = RasterAnalysis(client)
|
|
723
|
+
>>> task = RasterAnalysis.proximity(raster=raster, output_raster_name='test')
|
|
744
724
|
"""
|
|
745
|
-
endpoint = f'{
|
|
725
|
+
endpoint = f'{self.BASE_ENDPOINT}proximity/'
|
|
746
726
|
|
|
747
727
|
data = clean_data({
|
|
748
728
|
'raster_uuid': raster.uuid,
|
|
@@ -753,5 +733,5 @@ class Analysis(Base):
|
|
|
753
733
|
'user_id': user_id
|
|
754
734
|
})
|
|
755
735
|
|
|
756
|
-
response = api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
757
|
-
return api.get_task(response['task_id'])
|
|
736
|
+
response = self.api.post(endpoint=endpoint, payload=data, is_json=False)
|
|
737
|
+
return self.api.get_task(response['task_id'])
|