geobox 2.1.0__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 +491 -574
  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 +88 -454
  20. geobox/aio/{analysis.py → raster_analysis.py} +153 -170
  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 +316 -414
  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 +14 -98
  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 +31 -1
  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 +5 -368
  52. geobox/{analysis.py → raster_analysis.py} +108 -128
  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 -110
  62. geobox/version.py +272 -272
  63. geobox/view.py +981 -981
  64. geobox/workflow.py +338 -339
  65. {geobox-2.1.0.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
  66. geobox-2.2.0.dist-info/RECORD +72 -0
  67. geobox-2.1.0.dist-info/RECORD +0 -70
  68. {geobox-2.1.0.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
  69. {geobox-2.1.0.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
  70. {geobox-2.1.0.dist-info → geobox-2.2.0.dist-info}/top_level.txt +0 -0
geobox/raster.py CHANGED
@@ -18,7 +18,7 @@ if TYPE_CHECKING:
18
18
  from . import GeoboxClient
19
19
  from .user import User
20
20
  from .aio import AsyncGeoboxClient
21
- from .aio.raster import Raster as AsyncRaster
21
+ from .aio.raster import AsyncRaster
22
22
 
23
23
  class Raster(Base):
24
24
 
@@ -214,7 +214,7 @@ class Raster(Base):
214
214
  >>> raster = Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
215
215
  >>> raster.delete()
216
216
  """
217
- super().delete(self.endpoint)
217
+ super()._delete(self.endpoint)
218
218
 
219
219
 
220
220
  @property
@@ -232,7 +232,7 @@ class Raster(Base):
232
232
  >>> raster = Raster.get_raster(client, uuid="12345678-1234-5678-1234-567812345678")
233
233
  >>> raster.thumbnail
234
234
  """
235
- return super().thumbnail(format='')
235
+ return super()._thumbnail(format='')
236
236
 
237
237
 
238
238
  @property
@@ -852,7 +852,7 @@ class Raster(Base):
852
852
  async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
853
853
 
854
854
  Returns:
855
- geobox.aio.raster.Raster: the async instance of the raster.
855
+ AsyncRaster: the async instance of the raster.
856
856
 
857
857
  Example:
858
858
  >>> from geobox import Geoboxclient
@@ -863,374 +863,11 @@ class Raster(Base):
863
863
  >>> async with AsyncGeoboxClient() as async_client:
864
864
  >>> async_raster = raster.to_async(async_client)
865
865
  """
866
- from .aio.raster import Raster as AsyncRaster
866
+ from .aio.raster import AsyncRaster
867
867
 
868
868
  return AsyncRaster(api=async_client, uuid=self.uuid, data=self.data)
869
869
 
870
870
 
871
- def polygonize(self,
872
- output_layer_name: str,
873
- band_index: int = 1,
874
- value_field: Optional[str] = None,
875
- mask_nodata: bool = False,
876
- connectivity: PolygonizeConnectivity = PolygonizeConnectivity.connected_4,
877
- keep_values: Optional[str] = None,
878
- layer_name: Optional[str] = None,
879
- user_id: Optional[int] = None) -> 'Task':
880
- """
881
- Convert a raster to vector polygons
882
-
883
- vectorizes a raster (polygonize) to a vector dataset (*.gpkg). Only users with Publisher role or higher can perform this operation
884
-
885
- Args:
886
- api (GeoboxClient): The GeoboxClient instance for making requests
887
- raster (Raster): Raster instance
888
- output_layer_name (str): Name for the output vector layer.
889
- band_index (int, optional): Raster band to polygonize. default: 1
890
- value_field (str, optional): Name of attribute field storing the pixel value. default: None
891
- mask_nodata (bool, optional): If True, NoData pixels are excluded using the band mask. default: False
892
- connectivity (PolygonizeConnectivity, optional): 4 or 8 connectivity for region grouping. default: PolygonizeConnectivity.connected_4
893
- keep_values (str, optional): JSON array of values to keep (e.g., '[1,2,3]'). default: None
894
- layer_name (str, optional): Output layer name. default: None
895
- user_id (int, optional): specific user. priviledges required!
896
-
897
- Returns:
898
- Task: task instance of the process
899
-
900
- Example:
901
- >>> from geobox import GeoboxClient
902
- >>> client = GeoboxClient()
903
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
904
- >>> raster.polygonize(output_layer_name='test')
905
- """
906
- from .analysis import Analysis
907
- return Analysis.polygonize(self.api,
908
- self,
909
- output_layer_name=output_layer_name,
910
- band_index=band_index,
911
- value_field=value_field,
912
- mask_nodata=mask_nodata,
913
- connectivity=connectivity,
914
- keep_values=keep_values,
915
- layer_name=layer_name,
916
- user_id=user_id)
917
-
918
-
919
- def clip(self,
920
- layer: Union[VectorLayer, VectorLayerView],
921
- output_raster_name: str,
922
- where: Optional[str] = None,
923
- dst_nodata: int = -9999,
924
- crop: bool = True,
925
- resample: AnalysisResampleMethod = AnalysisResampleMethod.near,
926
- user_id: Optional[int] = None) -> 'Task':
927
- """
928
- Clip a raster using a vector layer as a mask
929
-
930
- clips a raster dataset using a vector layer as the clipping boundary. Only users with Publisher role or higher can perform this operation
931
-
932
- Args:
933
- api (GeoboxClient): The GeoboxClient instance for making requests
934
- raster (Raster): Raster instance
935
- layer (VectorLayer | VectorLayerView): VectorLayer or VectorLayerView instance
936
- output_raster_name (str): Name for the output raster dataset
937
- where (str, optional): Optional attribute filter, e.g. 'VEG=forest'.
938
- dst_nodata (int, optional): Output NoData value. default: -9999
939
- crop (bool, optional): True=shrink extent to polygon(s); False=keep full extent but mask outside. default: True
940
- resample (AnalysisResampleMethod, optional): Resampling method: 'near', 'bilinear', 'cubic', 'lanczos', etc. default: AnalysisResampleMethod.near
941
- user_id (int, optional): specific user. priviledges required!
942
-
943
- Returns:
944
- Task: task instance of the process
945
-
946
- Example:
947
- >>> from geobox import GeoboxClient
948
- >>> client = GeoboxClient()
949
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
950
- >>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
951
- >>> raster.clip(layer=vector, output_raster_name='test')
952
- """
953
- from .analysis import Analysis
954
- return Analysis.clip(self.api,
955
- self,
956
- layer=layer,
957
- output_raster_name=output_raster_name,
958
- where=where,
959
- dst_nodata=dst_nodata,
960
- crop=crop,
961
- resample=resample,
962
- user_id=user_id)
963
-
964
-
965
- def slope(self,
966
- output_raster_name: str,
967
- slope_units: SlopeUnit = SlopeUnit.degree,
968
- algorithm: AnalysisAlgorithm = AnalysisAlgorithm.Horn,
969
- scale: int = 1,
970
- compute_edges: bool = True,
971
- nodata_out: int = -9999,
972
- user_id: Optional[int] = None) -> 'Task':
973
- """
974
- Calculate slope from a DEM raster.
975
-
976
- This endpoint creates a slope raster from a Digital Elevation Model (DEM). Only users with Publisher role or higher can perform this operation.
977
-
978
- Args:
979
- output_raster_name (str): Name for the output raster dataset.
980
- slope_units (SlopeUnit, optional): Slope units: 'degree' or 'percent'. default: SlopeUnit.degree
981
- algorithm (AnalysisAlgorithm, optional): Algorithm: 'Horn' or 'ZevenbergenThorne'. default: AnalysisAlgorithm.Horn
982
- scale (int, optional): Ratio of vertical units to horizontal units. default: 1
983
- compute_edges (bool, optional): Whether to compute edges. default: True
984
- nodata (int, optional): NoData value for the output raster. default = -9999
985
- user_id (int, optional): specific user. priviledges required!
986
-
987
- Returns:
988
- Task: task instance of the process
989
-
990
- Example:
991
- >>> from geobox import GeoboxClient
992
- >>> client = GeoboxClient()
993
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
994
- >>> raster.slope(output_raster_name='test')
995
- """
996
- from .analysis import Analysis
997
- return Analysis.slope(self.api,
998
- self,
999
- slope_units=slope_units,
1000
- output_raster_name=output_raster_name,
1001
- algorithm=algorithm,
1002
- scale=scale,
1003
- compute_edges=compute_edges,
1004
- nodata_out=nodata_out,
1005
- user_id=user_id)
1006
-
1007
-
1008
- def aspect(self,
1009
- output_raster_name: str,
1010
- algorithm: AnalysisAlgorithm = AnalysisAlgorithm.Horn,
1011
- trigonometric: bool = False,
1012
- zero_for_flat: bool = True,
1013
- compute_edges: bool = True,
1014
- nodata_out: int = -9999,
1015
- user_id: Optional[int] = None) -> 'Task':
1016
- """
1017
- Calculate aspect from a DEM raster.
1018
-
1019
- it creates an aspect raster (degrees 0–360) from a Digital Elevation Model (DEM).
1020
- Only users with Publisher role or higher can perform this operation.
1021
-
1022
- Args:
1023
- api (GeoboxClient): The GeoboxClient instance for making requests
1024
- raster (Raster): DEM Raster instance
1025
- output_raster_name (str): Name for the output raster dataset.
1026
- algorithm (AnalysisAlgorithm, optional): Algorithm: 'Horn' or 'ZevenbergenThorne'. default: AnalysisAlgorithm.Horn
1027
- trigonometric (bool, optional): False: azimuth (0°=N, 90°=E, clockwise); True: 0°=E, counter-clockwise. default: False
1028
- zero_for_flat (bool, optional): Set flats (slope==0) to 0 instead of NoData. default: True
1029
- compute_edges (bool, optional): Whether to compute edges. default: True
1030
- nodata (int, optional): NoData value for the output raster. default = -9999
1031
- user_id (int, optional): specific user. priviledges required!
1032
-
1033
- Returns:
1034
- Task: task instance of the process
1035
-
1036
- Example:
1037
- >>> from geobox import GeoboxClient
1038
- >>> client = GeoboxClient()
1039
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1040
- >>> raster.aspect(output_raster_name='test')
1041
- """
1042
- from .analysis import Analysis
1043
- return Analysis.aspect(self.api,
1044
- self,
1045
- output_raster_name=output_raster_name,
1046
- algorithm=algorithm,
1047
- trigonometric=trigonometric,
1048
- zero_for_flat=zero_for_flat,
1049
- compute_edges=compute_edges,
1050
- nodata_out=nodata_out,
1051
- user_id=user_id)
1052
-
1053
-
1054
- def reclassify(self,
1055
- output_raster_name: str,
1056
- rules: str,
1057
- default_value: Optional[int] = None,
1058
- nodata_in: int = -9999,
1059
- nodata_out: int = -9999,
1060
- out_dtype: AnalysisDataType = AnalysisDataType.int16,
1061
- inclusive: RangeBound = RangeBound.left,
1062
- user_id: Optional[int] = None) -> 'Task':
1063
- """
1064
- Reclassify a raster using value mapping or class breaks.
1065
-
1066
- This endpoint reclassifies raster values according to specified rules.
1067
- Only users with Publisher role or higher can perform this operation.
1068
-
1069
- Args:
1070
- output_raster_name (str): Name for the output reclassified raster dataset.
1071
- rules (str): JSON string containing reclassification rules.
1072
- For mode='exact', it should be a dict {old_value: new_value}.
1073
- For mode='range', it should be a list of (low, high, new_value).
1074
- Example for mode='exact': '{"1": 10, "2": 20, "3": 30}'.
1075
- Example for mode='range': '[[0, 10, 1], [10, 20, 2], [20, 30, 3]]'.
1076
- the method would detect the mode type based on the rules input.
1077
- default_value (str, optional): Value to assign when a pixel matches no rule.
1078
- nodata_in (int, optional): NoData of input. If None, tries to get from the input raster.
1079
- nodata_out (int, optional): NoData value to set on output band.
1080
- out_dtype (AnalysisDataType, optional): Output data type. default: AnalysisDataType.int16
1081
- inclusive (RangeBound, optional): Range bound semantics for mode='range': 'left', 'right', 'both', 'neither'. default: RangeBound.left
1082
- user_id (int, optional): specific user. priviledges required!
1083
-
1084
- Returns:
1085
- Task: task instance of the process
1086
-
1087
- Example:
1088
- >>> from geobox import GeoboxClient
1089
- >>> client = GeoboxClient()
1090
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1091
- >>> raster.reclassify(output_raster_name='test', rules='{"1": 10, "2": 20, "3": 30}')
1092
- """
1093
- from .analysis import Analysis
1094
- return Analysis.reclassify(self.api,
1095
- self,
1096
- output_raster_name=output_raster_name,
1097
- rules=rules,
1098
- default_value=default_value,
1099
- nodata_in=nodata_in,
1100
- nodata_out=nodata_out,
1101
- out_dtype=out_dtype,
1102
- inclusive=inclusive,
1103
- user_id=user_id)
1104
-
1105
-
1106
- def resample(self,
1107
- output_raster_name: str,
1108
- out_res: Optional[str] = None,
1109
- scale_factor: Optional[str] = None,
1110
- match_raster_uuid: Optional[str] = None,
1111
- resample_method: AnalysisResampleMethod = AnalysisResampleMethod.near,
1112
- dst_nodata: int = -9999,
1113
- user_id: Optional[int] = None) -> 'Task':
1114
- """
1115
- Resample a raster to a different resolution.
1116
-
1117
- it resamples a raster using GDAL Warp.
1118
- Exactly one of out_res, scale_factor, or match_raster_uuid must be provided.
1119
- Only users with Publisher role or higher can perform this operation.
1120
-
1121
- Args:
1122
- output_raster_name (str): Name for the output reclassified raster dataset.
1123
- out_res (str, optional): Output resolution as 'x_res,y_res' (e.g., '10,10').
1124
- scale_factor (int, optional): Scale factor (e.g., 2.0 for 2x finer resolution).
1125
- match_raster_uuid (str, optional): UUID of reference raster to match resolution/extent.
1126
- resample_method (AnalysisResampleMethod, optional): Resampling method: 'near', 'bilinear', 'cubic', 'lanczos', etc.
1127
- dst_nodata (int, optional): Output NoData value.
1128
- user_id (int, optional): specific user. priviledges required!
1129
-
1130
- Returns:
1131
- Task: task instance of the process
1132
-
1133
- Example:
1134
- >>> from geobox import GeoboxClient
1135
- >>> client = GeoboxClient()
1136
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1137
- >>> raster.resample(output_raster_name='test')
1138
- """
1139
- from .analysis import Analysis
1140
- return Analysis.resample(self.api,
1141
- self,
1142
- output_raster_name=output_raster_name,
1143
- out_res=out_res,
1144
- scale_factor=scale_factor,
1145
- match_raster_uuid=match_raster_uuid,
1146
- resample_method=resample_method,
1147
- dst_nodata=dst_nodata,
1148
- user_id=user_id)
1149
-
1150
-
1151
- def fill_nodata(self,
1152
- output_raster_name: str,
1153
- band: Union[int, str] = 1,
1154
- nodata: Optional[int] = None,
1155
- max_search_dist: Optional[int] = None,
1156
- smoothing_iterations: Optional[int] = None,
1157
- mask_raster_uuid: Optional[str] = None,
1158
- user_id: Optional[int] = None) -> 'Task':
1159
- """
1160
- Fill NoData regions in a raster using GDAL's FillNodata algorithm.
1161
-
1162
- it fills gaps (NoData regions) in a raster by interpolating values from surrounding valid pixels.
1163
- This is commonly used for data cleaning and gap filling in remote sensing and elevation data.
1164
- Only users with Publisher role or higher can perform this operation.
1165
-
1166
- Args:
1167
- output_raster_name (str): Name for the output filled raster dataset.
1168
- band (int | str): 1-based band index to process or 'all' to process all bands. default: 1
1169
- nodata (int, optional): NoData value to use. If None, uses the band's existing NoData.
1170
- max_search_dist (int, optoinal): Maximum distance in pixels to search for valid data.
1171
- smoothing_iterations (int, optional): Number of smoothing iterations to apply.
1172
- mask_raster_uuid (str, optional): Optional UUID of a mask raster (0=masked, >0=valid).
1173
- user_id (int, optional): specific user. priviledges required!
1174
-
1175
- Returns:
1176
- Task: task instance of the process
1177
-
1178
- Example:
1179
- >>> from geobox import GeoboxClient
1180
- >>> client = GeoboxClient()
1181
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1182
- >>> task = raster.fill_nodata(output_raster_name='test')
1183
- """
1184
- from .analysis import Analysis
1185
- return Analysis.fill_nodata(self.api,
1186
- self,
1187
- output_raster_name=output_raster_name,
1188
- band=band,
1189
- nodata=nodata,
1190
- max_search_dist=max_search_dist,
1191
- smoothing_iterations=smoothing_iterations,
1192
- mask_raster_uuid=mask_raster_uuid,
1193
- user_id=user_id)
1194
-
1195
-
1196
- def proximity(self,
1197
- output_raster_name: str,
1198
- dist_units: DistanceUnit = DistanceUnit.GEO,
1199
- burn_value: int = 1,
1200
- nodata: int = -9999,
1201
- user_id: Optional[int] = None) -> 'Task':
1202
- """
1203
- Create a proximity (distance) raster from a raster layer.
1204
-
1205
- it creates a raster showing the distance from each pixel to the nearest pixel in the input raster layer.
1206
- Only users with Publisher role or higher can perform this operation.
1207
-
1208
- Args:
1209
- output_raster_name (str): Name for the output proximity raster dataset.
1210
- dist_units (DistanceUnit, optional): Distance units: 'GEO' for georeferenced units, 'PIXEL' for pixels. default: DistanceUnit.GEO
1211
- burn_value (int, optional): Value treated as targets (distance 0). default: 1
1212
- nodata (int, optional): NoData value to use in the output raster. default: -9999
1213
- user_id (int, optional): specific user. priviledges required!
1214
-
1215
- Returns:
1216
- Task: task instance of the process
1217
-
1218
- Example:
1219
- >>> from geobox import GeoboxClient
1220
- >>> client = GeoboxClient()
1221
- >>> raster = client.get_raster(uuid="12345678-1234-5678-1234-567812345678")
1222
- >>> task = raster.proximity(output_raster_name='test')
1223
- """
1224
- from .analysis import Analysis
1225
- return Analysis.proximity(self.api,
1226
- self,
1227
- output_raster_name=output_raster_name,
1228
- dist_units=dist_units,
1229
- burn_value=burn_value,
1230
- nodata=nodata,
1231
- user_id=user_id)
1232
-
1233
-
1234
871
  def profile(self,
1235
872
  polyline: List,
1236
873
  number_of_samples: int = 100,