geobox 2.0.0__py3-none-any.whl → 2.1.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/aio/task.py CHANGED
@@ -250,7 +250,7 @@ class Task(AsyncBase):
250
250
 
251
251
  def _check_timeout(self, start_time: float, timeout: Union[int, None]) -> None:
252
252
  """Checks if the task has exceeded the timeout period."""
253
- if timeout and time.time() - start_time > timeout:
253
+ if timeout and time.time() - start_time > float(timeout):
254
254
  raise TimeoutError(f"Task {self.name} timed out after {timeout} seconds")
255
255
 
256
256
 
geobox/aio/usage.py CHANGED
@@ -168,7 +168,7 @@ class Usage(AsyncBase):
168
168
  user_id (int, optional): the id of the user. leave blank to get the current user report.
169
169
 
170
170
  Returns:
171
- Dict: the usage summery of the users
171
+ Dict: the usage summary of the users
172
172
 
173
173
  Returns:
174
174
  >>> from geobox.aio import AsyncGeoboxClient
geobox/aio/vectorlayer.py CHANGED
@@ -8,7 +8,7 @@ from .task import Task
8
8
  from .version import VectorLayerVersion
9
9
  from ..utils import clean_data
10
10
  from ..exception import NotFoundError
11
- from ..enums import LayerType, InputGeomType, FileOutputFormat
11
+ from ..enums import LayerType, InputGeomType, FileOutputFormat, AnalysisDataType
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from .api import AsyncGeoboxClient
@@ -1360,4 +1360,111 @@ class VectorLayer(AsyncBase):
1360
1360
  """
1361
1361
  from ..vectorlayer import VectorLayer as SyncVectorLayer
1362
1362
 
1363
- return SyncVectorLayer(api=sync_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
1363
+ return SyncVectorLayer(api=sync_client, uuid=self.uuid, layer_type=self.layer_type, data=self.data)
1364
+
1365
+
1366
+
1367
+
1368
+ async def rasterize(self,
1369
+ output_raster_name: str,
1370
+ pixel_size: int = 10,
1371
+ nodata: Optional[int] = -9999,
1372
+ data_type: Optional[AnalysisDataType] = AnalysisDataType.int16,
1373
+ burn_value: Optional[int] = 1,
1374
+ burn_attribute: Optional[str] = None,
1375
+ user_id: Optional[int] = None) -> 'Task':
1376
+ """
1377
+ [async] Rasterize a vector layer.
1378
+
1379
+ This method converts a vector layer (or view) to a raster dataset using the specified parameters.
1380
+ You can control the output raster's name, pixel size, data type, nodata value, and the value to burn (either a constant or from an attribute field).
1381
+ Only users with Publisher role or higher can perform this operation.
1382
+
1383
+ Args:
1384
+ output_raster_name (str): Name for the output raster dataset
1385
+ pixel_size (int, optional): Pixel size for the output raster (must be > 0). default: 10
1386
+ nodata (int, optional): NoData value to use in the output raster. default: -9999
1387
+ data_type (AnalysisDataType, optional): Data type for the output raster (e.g., int16, float32). default: AnalysisDataType.int16
1388
+ burn_value (int, optional): Value to burn into the raster for all features (if burn_attribute is not set). default: 1
1389
+ burn_attribute (str, optional): Name of the attribute field to use for burning values into the raster
1390
+ user_id (int, optional): specific user. priviledges required!
1391
+
1392
+ Returns:
1393
+ Task: task instance of the process
1394
+
1395
+ Example:
1396
+ >>> from geobox.aio import AsyncGeoboxClient
1397
+ >>> async with AsyncGeoboxClient() as client:
1398
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1399
+ >>> task = await vector.rasterize(output_raster_name='test')
1400
+ """
1401
+ from .analysis import Analysis
1402
+ return await Analysis.rasterize(self.api,
1403
+ self,
1404
+ output_raster_name=output_raster_name,
1405
+ burn_attribute=burn_attribute,
1406
+ pixel_size=pixel_size,
1407
+ nodata=nodata,
1408
+ data_type=data_type,
1409
+ burn_value=burn_value,
1410
+ user_id=user_id)
1411
+
1412
+
1413
+ async def idw_interpolation(self,
1414
+ output_raster_name: str,
1415
+ z_field: Field,
1416
+ match_raster_uuid: Optional[str] = None,
1417
+ pixel_size: int = 10,
1418
+ extent: Optional[str] = None,
1419
+ power: float = 2.0,
1420
+ smoothing: float = 0.0,
1421
+ max_points: int = 16,
1422
+ radius: int = 1000,
1423
+ nodata: int = -9999,
1424
+ out_dtype: AnalysisDataType = AnalysisDataType.float32,
1425
+ user_id: Optional[int] = None) -> 'Task':
1426
+ """
1427
+ [async] Create an IDW (Inverse Distance Weighting) interpolation raster from point data.
1428
+
1429
+ it creates a raster using IDW interpolation from point data in a vector layer.
1430
+ Only users with Publisher role or higher can perform this operation.
1431
+
1432
+ Args:
1433
+ output_raster_name (str): Name for the output IDW raster dataset.
1434
+ z_field (Field): the field containing the values to interpolate.
1435
+ match_raster_uuid (str, optional): UUID of reference raster to match resolution/extent.
1436
+ pixel_size (int, optional): Pixel size for the output raster. default: 10
1437
+ extent (str, optional): Extent as 'minX,minY,maxX,maxY'.
1438
+ power (float, optional): Power parameter for IDW. default: 2.0
1439
+ smoothing (float, optional): Smoothing parameter for IDW. default: 0.0
1440
+ max_points (int, optional): Maximum number of neighbors to use. default: 16
1441
+ radius (int, optional): Search radius in map units. default: 1000
1442
+ nodata (int, optional): NoData value for the output raster. default: -9999
1443
+ out_dtype (AnalysisDataType, optional): Output data type.
1444
+ user_id (int, optional): specific user. priviledges required!
1445
+
1446
+ Returns:
1447
+ Task: task instance of the process
1448
+
1449
+ Example:
1450
+ >>> from geobox.aio import AsyncGeoboxClient
1451
+ >>> async with AsyncGeoboxClient() as client:
1452
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1453
+ >>> field = await vector.get_field_by_name('field_name')
1454
+ >>> task = await vector.idw(output_raster_name='test', z_field=field)
1455
+ """
1456
+ from .analysis import Analysis
1457
+ return await Analysis.idw_interpolation(self.api,
1458
+ self,
1459
+ output_raster_name=output_raster_name,
1460
+ z_field=z_field,
1461
+ match_raster_uuid=match_raster_uuid,
1462
+ pixel_size=pixel_size,
1463
+ extent=extent,
1464
+ power=power,
1465
+ smoothing=smoothing,
1466
+ max_points=max_points,
1467
+ radius=radius,
1468
+ nodata=nodata,
1469
+ out_dtype=out_dtype,
1470
+ user_id=user_id)
geobox/aio/workflow.py CHANGED
@@ -92,7 +92,7 @@ class Workflow(AsyncBase):
92
92
  description (str): The description of the workflow.
93
93
  settings (Dict): The settings of the workflow.
94
94
  thumbnail (str): The thumbnail of the workflow.
95
- user_id (int): Specific user. privileges workflow.
95
+ user_id (int): Specific user. privileges required.
96
96
 
97
97
  Returns:
98
98
  Workflow: The newly created workflow instance.