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
@@ -0,0 +1,1968 @@
1
+ from typing import Dict, Optional, TYPE_CHECKING, Union
2
+
3
+ from geobox.exception import NotFoundError
4
+
5
+ from .feature import AsyncFeature
6
+ from .base import AsyncBase
7
+ from ..enums import GroupByAggFunction, NetworkTraceDirection, SpatialAggFunction, SpatialPredicate
8
+
9
+ if TYPE_CHECKING:
10
+ from . import AsyncGeoboxClient
11
+ from .task import AsyncTask
12
+ from .query import AsyncQuery
13
+
14
+
15
+
16
+ class AsyncVectorTool(AsyncBase):
17
+
18
+ BASE_ENDPOINT = 'queries/'
19
+
20
+ def __init__(self, api: 'AsyncGeoboxClient'):
21
+ """
22
+ Initialize an async VectorTool instance.
23
+
24
+ Args:
25
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
26
+ """
27
+ super().__init__(api)
28
+
29
+
30
+ def __repr__(self) -> str:
31
+ return f"AsyncVectorTool()"
32
+
33
+
34
+ async def _add_params_to_query(self, query_name: str, inputs: dict) -> 'AsyncQuery':
35
+ """add user input params to the query"""
36
+ queries = await self.api.get_system_queries(q=f"name = '{query_name}'")
37
+ try:
38
+ query = next(query for query in queries if query.name == query_name)
39
+ except StopIteration:
40
+ raise NotFoundError("Vector Tool not found!")
41
+
42
+ for param in query.params:
43
+ if param['name'] in inputs.keys():
44
+ query.params[query.params.index(param)]['value'] = inputs[param['name']]
45
+
46
+ return query
47
+
48
+
49
+ async def _run_query(self, query: 'AsyncQuery', output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
50
+ """execute or save as layer"""
51
+ if not output_layer_name:
52
+ response = await query.execute()
53
+ return response
54
+
55
+ else:
56
+ task = await query.save_as_layer(layer_name=output_layer_name)
57
+ return task
58
+
59
+
60
+ async def area(self,
61
+ vector_uuid: str,
62
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
63
+ """
64
+ [async] Computes and adds a new column for the area of each polygon in the layer, aiding in spatial measurements
65
+
66
+ Args:
67
+ vector_uuid (str): UUID of the vector layer
68
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
69
+
70
+ Returns:
71
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
72
+
73
+ Example:
74
+ >>> from geobox.aio import AsyncGeoboxClient
75
+ >>> async with AsyncGeoboxClient() as client:
76
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
77
+
78
+ >>> # execution
79
+ >>> result = await client.vector_tool.area(vector_uuid=vector.uuid)
80
+
81
+ >>> # save as layer
82
+ >>> task = await client.vector_tool.area(vector_uuid=vector.uuid, output_layer_name="output_layer")
83
+ >>> await task.wait()
84
+ >>> output_layer = await task.output_asset
85
+ """
86
+ inputs = {
87
+ 'layer': vector_uuid
88
+ }
89
+ query = await self._add_params_to_query(query_name='$area', inputs=inputs)
90
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
91
+
92
+
93
+ async def as_geojson(self,
94
+ vector_uuid: str,
95
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
96
+ """
97
+ [async] Converts geometries to GeoJSON format, adding a column with GeoJSON strings for each geometry in the layer
98
+
99
+ Args:
100
+ vector_uuid (str): UUID of the vector layer
101
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
102
+
103
+ Returns:
104
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
105
+
106
+ Example:
107
+ >>> from geobox.aio import AsyncGeoboxClient
108
+ >>> async with AsyncGeoboxClient() as client:
109
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
110
+
111
+ >>> # execution
112
+ >>> result = await client.vector_tool.as_geojson(vector_uuid=vector.uuid)
113
+
114
+ >>> # save as layer
115
+ >>> task = await client.vector_tool.as_geojson(vector_uuid=vector.uuid, output_layer_name="output_layer")
116
+ >>> await task.wait()
117
+ >>> output_layer = await task.output_asset
118
+ """
119
+ inputs = {
120
+ 'layer': vector_uuid
121
+ }
122
+ query = await self._add_params_to_query(query_name='$as_geojson', inputs=inputs)
123
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
124
+
125
+
126
+ async def as_wkt(self,
127
+ vector_uuid: str,
128
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
129
+ """
130
+ [async] Converts geometries into WKT (Well-Known Text) format, storing it as a new column in the layer
131
+
132
+ Args:
133
+ vector_uuid (str): UUID of the vector layer
134
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
135
+
136
+ Returns:
137
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
138
+
139
+ Example:
140
+ >>> from geobox.aio import AsyncGeoboxClient
141
+ >>> async with AsyncGeoboxClient() as client:
142
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
143
+
144
+ >>> # execution
145
+ >>> result = await client.vector_tool.as_wkt(vector_uuid=vector.uuid)
146
+
147
+ >>> # save as layer
148
+ >>> task = await client.vector_tool.as_wkt(vector_uuid=vector.uuid, output_layer_name="output_layer")
149
+ >>> await task.wait()
150
+ >>> output_layer = await task.output_asset
151
+ """
152
+ inputs = {
153
+ 'layer': vector_uuid
154
+ }
155
+ query = await self._add_params_to_query(query_name='$as_wkt', inputs=inputs)
156
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
157
+
158
+
159
+ async def buffer(self,
160
+ vector_uuid: str,
161
+ distance: float,
162
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
163
+ """
164
+ [async] Generates a buffer zone around each geometry in the layer, expanding each shape by a specified distance
165
+
166
+ Args:
167
+ vector_uuid (str): UUID of the vector layer
168
+ distance (float): Buffer distance
169
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
170
+
171
+ Returns:
172
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
173
+
174
+ Example:
175
+ >>> from geobox.aio import AsyncGeoboxClient
176
+ >>> async with AsyncGeoboxClient() as client:
177
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
178
+
179
+ >>> # execution
180
+ >>> result = await client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000)
181
+
182
+ >>> # save as layer
183
+ >>> task = await client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000, output_layer_name="output_layer")
184
+ >>> await task.wait()
185
+ >>> output_layer = await task.output_asset
186
+ """
187
+ inputs = {
188
+ 'layer': vector_uuid,
189
+ 'distance': distance
190
+ }
191
+ query = await self._add_params_to_query(query_name='$buffer', inputs=inputs)
192
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
193
+
194
+
195
+ async def centroid(self,
196
+ vector_uuid: str,
197
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
198
+ """
199
+ [async] Calculates the centroid point of each geometry, which represents the geometric center of each shape
200
+
201
+ Args:
202
+ vector_uuid (str): UUID of the vector layer
203
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
204
+
205
+ Returns:
206
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
207
+
208
+ Example:
209
+ >>> from geobox.aio import AsyncGeoboxClient
210
+ >>> async with AsyncGeoboxClient() as client:
211
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
212
+
213
+ >>> # execution
214
+ >>> result = await client.vector_tool.centroid(vector_uuid=vector.uuid)
215
+
216
+ >>> # save as layer
217
+ >>> task = await client.vector_tool.centroid(vector_uuid=vector.uuid, output_layer_name="output_layer")
218
+ >>> await task.wait()
219
+ >>> output_layer = await task.output_asset
220
+ """
221
+ inputs = {
222
+ 'layer': vector_uuid
223
+ }
224
+ query = await self._add_params_to_query(query_name='$centroid', inputs=inputs)
225
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
226
+
227
+
228
+ async def clip(self,
229
+ vector_uuid: str,
230
+ clip_vector_uuid: str,
231
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
232
+ """
233
+ [async] Clips geometries and retains only the parts of the geometries that fall within the specified boundaries
234
+
235
+ Args:
236
+ vector_uuid (str): UUID of the vector layer
237
+ clip_vector_uuid (str): UUID of the clip vector layer
238
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
239
+
240
+ Returns:
241
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
242
+
243
+ Example:
244
+ >>> from geobox.aio import AsyncGeoboxClient
245
+ >>> async with AsyncGeoboxClient() as client:
246
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
247
+ >>> clip_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
248
+
249
+ >>> # execution
250
+ >>> result = await client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid)
251
+
252
+ >>> # save as layer
253
+ >>> task = await client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid, output_layer_name="output_layer")
254
+ >>> await task.wait()
255
+ >>> output_layer = await task.output_asset
256
+ """
257
+ inputs = {
258
+ 'layer': vector_uuid,
259
+ 'clip': clip_vector_uuid
260
+ }
261
+ query = await self._add_params_to_query(query_name='$clip', inputs=inputs)
262
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
263
+
264
+
265
+ async def concave_hull(self,
266
+ vector_uuid: str,
267
+ tolerance: float,
268
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
269
+ """
270
+ [async] Creates a concave hull (a polygon that closely wraps around all geometries) for the layer with a specified tolerance
271
+
272
+ Args:
273
+ vector_uuid (str): UUID of the vector layer
274
+ tolerance (float): Tolerance parameter for concave hull
275
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
276
+
277
+ Returns:
278
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
279
+
280
+ Example:
281
+ >>> from geobox.aio import AsyncGeoboxClient
282
+ >>> async with AsyncGeoboxClient() as client:
283
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
284
+
285
+ >>> # execution
286
+ >>> result = await client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10)
287
+
288
+ >>> # save as layer
289
+ >>> task = await client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10, output_layer_name="output_layer")
290
+ >>> await task.wait()
291
+ >>> output_layer = await task.output_asset
292
+ """
293
+ inputs = {
294
+ 'layer': vector_uuid,
295
+ 'tolerance': tolerance
296
+ }
297
+ query = await self._add_params_to_query(query_name='$concave_hull', inputs=inputs)
298
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
299
+
300
+
301
+ async def convex_hull(self,
302
+ vector_uuid: str,
303
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
304
+ """
305
+ [async] Calculates a convex hull for all geometries in a layer, creating a polygon that minimally contains all points or shapes
306
+
307
+ Args:
308
+ vector_uuid (str): UUID of the vector layer
309
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
310
+
311
+ Returns:
312
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
313
+
314
+ Example:
315
+ >>> from geobox.aio import AsyncGeoboxClient
316
+ >>> async with AsyncGeoboxClient() as client:
317
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
318
+
319
+ >>> # execution
320
+ >>> result = await client.vector_tool.convex_hull(vector_uuid=vector.uuid)
321
+
322
+ >>> # save as layer
323
+ >>> task = await client.vector_tool.convex_hull(vector_uuid=vector.uuid, output_layer_name="output_layer")
324
+ >>> await task.wait()
325
+ >>> output_layer = await task.output_asset
326
+ """
327
+ inputs = {
328
+ 'layer': vector_uuid
329
+ }
330
+ query = await self._add_params_to_query(query_name='$convex_hull', inputs=inputs)
331
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
332
+
333
+
334
+ async def feature_count(self, vector_uuid: str) -> Dict:
335
+ """
336
+ [async] Counts the total number of rows in the specified layer, which is useful for data volume estimation
337
+
338
+ Args:
339
+ vector_uuid (str): UUID of the vector layer
340
+
341
+ Returns:
342
+ Dict: the vector tool execution result.
343
+
344
+ Example:
345
+ >>> from geobox.aio import AsyncGeoboxClient
346
+ >>> async with AsyncGeoboxClient() as client:
347
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
348
+
349
+ >>> # execution
350
+ >>> result = await client.vector_tool.feature_count(vector_uuid=vector.uuid)
351
+ """
352
+ inputs = {
353
+ 'layer': vector_uuid
354
+ }
355
+ query = await self._add_params_to_query(query_name='$count', inputs=inputs)
356
+ return await self._run_query(query=query)
357
+
358
+
359
+ async def count_point_in_polygons(self,
360
+ polygon_vector_uuid: str,
361
+ point_vector_uuid: str,
362
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
363
+ """
364
+ [async] Counts the number of points within each polygon, giving a density measure of points per polygon
365
+
366
+ Args:
367
+ polygon_vector_uuid (str): UUID of the polygon layer
368
+ point_vector_uuid (str): UUID of the point layer
369
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
370
+
371
+ Returns:
372
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
373
+
374
+ Example:
375
+ >>> from geobox.aio import AsyncGeoboxClient
376
+ >>> async with AsyncGeoboxClient() as client:
377
+ >>> polygon_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
378
+ >>> point_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
379
+
380
+ >>> # execution
381
+ >>> result = await client.vector_tool.count_point_in_polygons(
382
+ ... polygon_vector_uuid=polygon_vector.uuid,
383
+ ... point_vector_uuid=point_vector.uuid)
384
+
385
+ >>> # save as layer
386
+ >>> task = await client.vector_tool.count_point_in_polygons(
387
+ ... polygon_vector_uuid=polygon_vector.uuid,
388
+ ... point_vector_uuid=point_vector.uuid,
389
+ ... output_layer_name="output_layer")
390
+ >>> await task.wait()
391
+ >>> output_layer = await task.output_asset
392
+ """
393
+ inputs = {
394
+ 'polygon_layer': polygon_vector_uuid,
395
+ 'point_layer': point_vector_uuid
396
+ }
397
+ query = await self._add_params_to_query(query_name='$count_point_in_polygons', inputs=inputs)
398
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
399
+
400
+
401
+ async def delaunay_triangulation(self,
402
+ vector_uuid: str,
403
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
404
+ """
405
+ [async] Generates Delaunay triangles from points, creating a tessellated network of polygons from input points
406
+
407
+ Args:
408
+ vector_uuid (str): UUID of the vector layer
409
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
410
+
411
+ Returns:
412
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
413
+
414
+ Example:
415
+ >>> from geobox.aio import AsyncGeoboxClient
416
+ >>> async with AsyncGeoboxClient() as client:
417
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
418
+
419
+ >>> # execution
420
+ >>> result = await client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid)
421
+
422
+ >>> # save as layer
423
+ >>> task = await client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid, output_layer_name="output_layer")
424
+ >>> await task.wait()
425
+ >>> output_layer = await task.output_asset
426
+ """
427
+ inputs = {
428
+ 'layer': vector_uuid
429
+ }
430
+ query = await self._add_params_to_query(query_name='$delaunay_triangulation', inputs=inputs)
431
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
432
+
433
+
434
+ async def disjoint(self,
435
+ vector_uuid: str,
436
+ filter_vector_uuid: str,
437
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
438
+ """
439
+ [async] Filters geometries that do not intersect with another layer, creating a subset with only disjoint geometries
440
+
441
+ Args:
442
+ vector_uuid (str): UUID of the vector layer
443
+ filter_vector_uuid (str): UUID of the filter layer
444
+ output_layer_name (str): Name for the output layer. name must be a valid identifier and without spacing.
445
+
446
+ Returns:
447
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
448
+
449
+ Example:
450
+ >>> from geobox.aio import AsyncGeoboxClient
451
+ >>> async with AsyncGeoboxClient() as client:
452
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
453
+ >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
454
+
455
+ >>> # execution
456
+ >>> result = await client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid)
457
+
458
+ >>> # save as layer
459
+ >>> task = await client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid, output_layer_name="output_layer")
460
+ >>> await task.wait()
461
+ >>> output_layer = await task.output_asset
462
+ """
463
+ inputs = {
464
+ 'layer': vector_uuid,
465
+ 'filter_layer': filter_vector_uuid
466
+ }
467
+ query = await self._add_params_to_query(query_name='$disjoint', inputs=inputs)
468
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
469
+
470
+
471
+ async def dissolve(self,
472
+ vector_uuid: str,
473
+ dissolve_field_name: str,
474
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
475
+ """
476
+ [async] Combines geometries based on a specified attribute, grouping them into single shapes for each unique attribute value
477
+
478
+ Args:
479
+ vector_uuid (str): UUID of the vector layer
480
+ dissolve_field_name (str): Field to dissolve by
481
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
482
+
483
+ Returns:
484
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
485
+
486
+ Example:
487
+ >>> from geobox.aio import AsyncGeoboxClient
488
+ >>> async with AsyncGeoboxClient() as client:
489
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
490
+
491
+ >>> # execution
492
+ >>> result = await client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name")
493
+
494
+ >>> # save as layer
495
+ >>> task = await client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name", output_layer_name="output_layer")
496
+ >>> await task.wait()
497
+ >>> output_layer = await task.output_asset
498
+ """
499
+ inputs = {
500
+ 'layer': vector_uuid,
501
+ 'dissolve_field': dissolve_field_name
502
+ }
503
+ query = await self._add_params_to_query(query_name='$dissolve', inputs=inputs)
504
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
505
+
506
+
507
+ async def distance_to_nearest(self,
508
+ vector_uuid: str,
509
+ nearest_vector_uuid: str,
510
+ search_radius: float,
511
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
512
+ """
513
+ [async] Calculates the minimum distance between geometries in one layer and their nearest neighbors in another
514
+
515
+ Args:
516
+ vector_uuid (str): UUID of the vector layer
517
+ nearest_vector_uuid (str): UUID of the nearest layer
518
+ search_radius (float): Search radius for nearest features
519
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
520
+
521
+ Returns:
522
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
523
+
524
+ Example:
525
+ >>> from geobox.aio import AsyncGeoboxClient
526
+ >>> async with AsyncGeoboxClient() as client:
527
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
528
+ >>> nearest_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
529
+
530
+ >>> # execution
531
+ >>> result = await client.vector_tool.distance_to_nearest(
532
+ ... vector_uuid=vector.uuid,
533
+ ... nearest_vector_uuid=nearest_vector.uuid,
534
+ ... search_radius=10)
535
+
536
+ >>> # save as layer
537
+ >>> task = await client.vector_tool.distance_to_nearest(
538
+ ... vector_uuid=vector.uuid,
539
+ ... nearest_vector_uuid=nearest_vector.uuid,
540
+ ... search_radius=10,
541
+ ... output_layer_name="output_layer")
542
+ >>> await task.wait()
543
+ >>> output_layer = await task.output_asset
544
+ """
545
+ inputs = {
546
+ 'layer': vector_uuid,
547
+ 'nearest_layer': nearest_vector_uuid,
548
+ 'search_radius': search_radius
549
+ }
550
+ query = await self._add_params_to_query(query_name='$distance_to_nearest', inputs=inputs)
551
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
552
+
553
+
554
+ async def distinct(self,
555
+ vector_uuid: str,
556
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
557
+ """
558
+ [async] Selects only unique rows from the input layer, removing duplicate entries across columns
559
+
560
+ Args:
561
+ vector_uuid (str): UUID of the vector layer
562
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
563
+
564
+ Returns:
565
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
566
+
567
+ Example:
568
+ >>> from geobox.aio import AsyncGeoboxClient
569
+ >>> async with AsyncGeoboxClient() as client:
570
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
571
+
572
+ >>> # execution
573
+ >>> result = await client.vector_tool.distinct(vector_uuid=vector.uuid)
574
+
575
+ >>> # save as layer
576
+ >>> task = await client.vector_tool.distinct(vector_uuid=vector.uuid, output_layer_name="output_layer")
577
+ >>> await task.wait()
578
+ >>> output_layer = await task.output_asset
579
+ """
580
+ inputs = {
581
+ 'layer': vector_uuid
582
+ }
583
+ query = await self._add_params_to_query(query_name='$distinct', inputs=inputs)
584
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
585
+
586
+
587
+ async def dump(self,
588
+ vector_uuid: str,
589
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
590
+ """
591
+ [async] Splits multi-part geometries into single-part geometries, producing individual shapes from complex collections
592
+
593
+ Args:
594
+ vector_uuid (str): UUID of the vector layer
595
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
596
+
597
+ Returns:
598
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
599
+
600
+ Example:
601
+ >>> from geobox.aio import AsyncGeoboxClient
602
+ >>> async with AsyncGeoboxClient() as client:
603
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
604
+
605
+ >>> # execution
606
+ >>> result = await client.vector_tool.dump(vector_uuid=vector.uuid)
607
+
608
+ >>> # save as layer
609
+ >>> task = await client.vector_tool.dump(vector_uuid=vector.uuid, output_layer_name="output_layer")
610
+ >>> await task.wait()
611
+ >>> output_layer = await task.output_asset
612
+ """
613
+ inputs = {
614
+ 'layer': vector_uuid
615
+ }
616
+ query = await self._add_params_to_query(query_name='$dump', inputs=inputs)
617
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
618
+
619
+
620
+ async def erase(self,
621
+ vector_uuid: str,
622
+ erase_vector_uuid: str,
623
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
624
+ """
625
+ [async] Removes portions of geometries that intersect with a specified erase layer, leaving only the non-overlapping parts
626
+
627
+ Args:
628
+ vector_uuid (str): UUID of the vector layer
629
+ erase_vector_uuid (str): UUID of the erase layer
630
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
631
+
632
+ Returns:
633
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
634
+
635
+ Example:
636
+ >>> from geobox.aio import AsyncGeoboxClient
637
+ >>> async with AsyncGeoboxClient() as client:
638
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
639
+ >>> erase_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
640
+
641
+ >>> # execution
642
+ >>> result = await client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid)
643
+
644
+ >>> # save as layer
645
+ >>> task = await client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid, output_layer_name="output_layer")
646
+ >>> await task.wait()
647
+ >>> output_layer = await task.output_asset
648
+ """
649
+ inputs = {
650
+ 'layer': vector_uuid,
651
+ 'erase': erase_vector_uuid
652
+ }
653
+ query = await self._add_params_to_query(query_name='$erase', inputs=inputs)
654
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
655
+
656
+
657
+ async def feature_bbox(self,
658
+ vector_uuid: str,
659
+ srid: int,
660
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
661
+ """
662
+ [async] Adds a bounding box column to each feature, showing the min/max x and y coordinates as a text representation
663
+
664
+ Args:
665
+ vector_uuid (str): UUID of the vector layer
666
+ srid (int): SRID for the output bounding boxes
667
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
668
+
669
+ Returns:
670
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
671
+
672
+ Example:
673
+ >>> from geobox.aio import AsyncGeoboxClient
674
+ >>> async with AsyncGeoboxClient() as client:
675
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
676
+
677
+ >>> # execution
678
+ >>> result = await client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326)
679
+
680
+ >>> # save as layer
681
+ >>> task = await client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326, output_layer_name="output_layer")
682
+ >>> await task.wait()
683
+ >>> output_layer = await task.output_asset
684
+ """
685
+ inputs = {
686
+ 'layer': vector_uuid,
687
+ 'srid': srid
688
+ }
689
+ query = await self._add_params_to_query(query_name='$feature_bbox', inputs=inputs)
690
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
691
+
692
+
693
+ async def feature_extent(self,
694
+ vector_uuid: str,
695
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
696
+ """
697
+ [async] Produces bounding boxes for each feature in the layer, representing the spatial extent of each geometry as a polygon
698
+
699
+ Args:
700
+ vector_uuid (str): UUID of the vector layer
701
+ output_layer_name (str): Name for the output layer. name must be a valid identifier and without spacing.
702
+
703
+ Returns:
704
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
705
+
706
+ Example:
707
+ >>> from geobox.aio import AsyncGeoboxClient
708
+ >>> async with AsyncGeoboxClient() as client:
709
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
710
+
711
+ >>> # execution
712
+ >>> result = await client.vector_tool.feature_extent(vector_uuid=vector.uuid)
713
+
714
+ >>> # save as layer
715
+ >>> task = await client.vector_tool.feature_extent(vector_uuid=vector.uuid, output_layer_name="output_layer")
716
+ >>> await task.wait()
717
+ >>> output_layer = await task.output_asset
718
+ """
719
+ inputs = {
720
+ 'layer': vector_uuid
721
+ }
722
+ query = await self._add_params_to_query(query_name='$feature_extent', inputs=inputs)
723
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
724
+
725
+
726
+ async def find_and_replace(self,
727
+ vector_uuid: str,
728
+ find: str,
729
+ replace: str,
730
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
731
+ """
732
+ [async] Finds and replaces specified text in a column, updating values based on input patterns
733
+
734
+ Args:
735
+ vector_uuid (str): UUID of the vector layer
736
+ find (str): Text to find
737
+ replace (str): Text to replace with
738
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
739
+
740
+ Returns:
741
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
742
+
743
+ Example:
744
+ >>> from geobox.aio import AsyncGeoboxClient
745
+ >>> async with AsyncGeoboxClient() as client:
746
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
747
+
748
+ >>> # execution
749
+ >>> result = await client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example")
750
+
751
+ >>> # save as layer
752
+ >>> task = await client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example", output_layer_name="output_layer")
753
+ >>> await task.wait()
754
+ >>> output_layer = await task.output_asset
755
+ """
756
+ inputs = {
757
+ 'layer': vector_uuid,
758
+ 'find': find,
759
+ 'replace': replace
760
+ }
761
+ query = await self._add_params_to_query(query_name='$find_replace', inputs=inputs)
762
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
763
+
764
+
765
+ async def from_geojson(self,
766
+ vector_uuid: str,
767
+ json_field_name: str,
768
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
769
+ """
770
+ [async] Converts GeoJSON strings in a specified column to geometries, adding these as a new column in the layer
771
+
772
+ Args:
773
+ vector_uuid (str): UUID of the vector layer
774
+ json_field_name (str): Name of the column containing GeoJSON strings
775
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
776
+
777
+ Returns:
778
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
779
+
780
+ Example:
781
+ >>> from geobox.aio import AsyncGeoboxClient
782
+ >>> async with AsyncGeoboxClient() as client:
783
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
784
+
785
+ >>> # execution
786
+ >>> result = await client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field")
787
+
788
+ >>> # save as layer
789
+ >>> task = await client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field", output_layer_name="output_layer")
790
+ >>> await task.wait()
791
+ >>> output_layer = await task.output_asset
792
+ """
793
+ inputs = {
794
+ 'layer': vector_uuid,
795
+ 'json_field': json_field_name
796
+ }
797
+ query = await self._add_params_to_query(query_name='$from_geojson', inputs=inputs)
798
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
799
+
800
+
801
+ async def from_wkt(self,
802
+ vector_uuid: str,
803
+ wkt_column_name: str,
804
+ srid: int,
805
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
806
+ """
807
+ [async] Converts WKT strings in a specified column to geometries, adding them as a new column in the layer
808
+
809
+ Args:
810
+ vector_uuid (str): UUID of the vector layer
811
+ wkt_column_name (str): Name of the column containing WKT strings
812
+ srid (int): SRID for the output geometries
813
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
814
+
815
+ Returns:
816
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
817
+
818
+ Example:
819
+ >>> from geobox.aio import AsyncGeoboxClient
820
+ >>> async with AsyncGeoboxClient() as client:
821
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
822
+
823
+ >>> # execution
824
+ >>> result = await client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field")
825
+
826
+ >>> # save as layer
827
+ >>> task = await client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field", output_layer_name="output_layer")
828
+ >>> await task.wait()
829
+ >>> output_layer = await task.output_asset
830
+ """
831
+ inputs = {
832
+ 'layer': vector_uuid,
833
+ 'wkt_column': wkt_column_name,
834
+ 'srid': srid
835
+ }
836
+ query = await self._add_params_to_query(query_name='$from_wkt', inputs=inputs)
837
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
838
+
839
+
840
+ async def generate_points(self,
841
+ vector_uuid: str,
842
+ number_of_points: int,
843
+ seed: int,
844
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
845
+ """
846
+ [async] Generates random points within each polygon, creating a specified number of points for each geometry
847
+
848
+ Args:
849
+ vector_uuid (str): UUID of the vector layer
850
+ number_of_points (int): Number of points to generate per polygon
851
+ seed (int): Random seed for reproducible results
852
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
853
+
854
+ Returns:
855
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
856
+
857
+ Example:
858
+ >>> from geobox.aio import AsyncGeoboxClient
859
+ >>> async with AsyncGeoboxClient() as client:
860
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
861
+
862
+ >>> # execution
863
+ >>> result = await client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10)
864
+
865
+ >>> # save as layer
866
+ >>> task = await client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10, output_layer_name="output_layer")
867
+ >>> await task.wait()
868
+ >>> output_layer = await task.output_asset
869
+ """
870
+ inputs = {
871
+ 'layer': vector_uuid,
872
+ 'number_of_points': number_of_points,
873
+ 'seed': seed
874
+ }
875
+ query = await self._add_params_to_query(query_name='$generate_points', inputs=inputs)
876
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
877
+
878
+
879
+ async def group_by(self,
880
+ vector_uuid: str,
881
+ group_column_name: str,
882
+ agg_column_name: str,
883
+ agg_function: 'GroupByAggFunction',
884
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
885
+ """
886
+ [async] Groups the layer by a specified column, applying aggregation functions like count, sum, min, max, and average
887
+
888
+ Args:
889
+ vector_uuid (str): UUID of the vector layer
890
+ group_column_name (str): Column to group by
891
+ agg_column_name (str): Column to aggregate
892
+ agg_function (GroupByAggFunction): Aggregation function: count, sum, min, max, avg
893
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
894
+
895
+ Returns:
896
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
897
+
898
+ Example:
899
+ >>> from geobox.aio import AsyncGeoboxClient
900
+ >>> from geobox.vector_tool import GroupByAggFunction
901
+ >>> async with AsyncGeoboxClient() as client:
902
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
903
+
904
+ >>> # execution
905
+ >>> result = await client.vector_tool.group_by(
906
+ ... vector_uuid=vector.uuid,
907
+ ... group_column_name="field_1",
908
+ ... agg_column_name="field_2",
909
+ ... agg_function=GroupByAggFunction.SUM)
910
+
911
+ >>> # save as layer
912
+ >>> task = await client.vector_tool.group_by(
913
+ ... vector_uuid=vector.uuid,
914
+ ... group_column_name="field_1",
915
+ ... agg_column_name="field_2",
916
+ ... agg_function=GroupByAggFunction.SUM,
917
+ ... output_layer_name="output_layer")
918
+ >>> await task.wait()
919
+ >>> output_layer = await task.output_asset
920
+ """
921
+ inputs = {
922
+ 'layer': vector_uuid,
923
+ 'group_column': group_column_name,
924
+ 'agg_column': agg_column_name,
925
+ 'agg_function': agg_function.value
926
+ }
927
+ query = await self._add_params_to_query(query_name='$group_by', inputs=inputs)
928
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
929
+
930
+
931
+ async def hexagon_grid(self,
932
+ vector_uuid: str,
933
+ cell_size: float,
934
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
935
+ """
936
+ [async] Creates a grid of hexagons over the layer extent, counting the number of features intersecting each hexagon
937
+
938
+ Args:
939
+ vector_uuid (str): UUID of the vector layer
940
+ cell_size (float): Size of hexagon cells
941
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
942
+
943
+ Returns:
944
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
945
+
946
+ Example:
947
+ >>> from geobox.aio import AsyncGeoboxClient
948
+ >>> async with AsyncGeoboxClient() as client:
949
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
950
+
951
+ >>> # execution
952
+ >>> result = await client.vector_tool.hexagon_grid(
953
+ ... vector_uuid=vector.uuid,
954
+ ... cell_size=10)
955
+
956
+ >>> # save as layer
957
+ >>> task = await client.vector_tool.hexagon_grid(
958
+ ... vector_uuid=vector.uuid,
959
+ ... cell_size=10,
960
+ ... output_layer_name="output_layer")
961
+ >>> await task.wait()
962
+ >>> output_layer = await task.output_asset
963
+ """
964
+ inputs = {
965
+ 'layer': vector_uuid,
966
+ 'cell_size': cell_size
967
+ }
968
+ query = await self._add_params_to_query(query_name='$hexagon_grid', inputs=inputs)
969
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
970
+
971
+
972
+ async def intersection(self,
973
+ vector_uuid: str,
974
+ intersect_vector_uuid: str,
975
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
976
+ """
977
+ [async] Calculates intersections between geometries in two layers, retaining only overlapping portions
978
+
979
+ Args:
980
+ vector_uuid (str): UUID of the vector layer
981
+ intersect_vector_uuid (str): UUID of the intersect layer
982
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
983
+
984
+ Returns:
985
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
986
+
987
+ Example:
988
+ >>> from geobox.aio import AsyncGeoboxClient
989
+ >>> async with AsyncGeoboxClient() as client:
990
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
991
+ >>> intersect_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
992
+
993
+ >>> # execution
994
+ >>> result = await client.vector_tool.hexagon_grid(
995
+ ... vector_uuid=vector.uuid,
996
+ ... intersect_vector_uuid=intersect_vector.uuid)
997
+
998
+ >>> # save as layer
999
+ >>> task = await client.vector_tool.hexagon_grid(
1000
+ ... vector_uuid=vector.uuid,
1001
+ ... intersect_vector_uuid=intersect_vector.uuid,
1002
+ ... output_layer_name="output_layer")
1003
+ >>> await task.wait()
1004
+ >>> output_layer = await task.output_asset
1005
+ """
1006
+ inputs = {
1007
+ 'layer': vector_uuid,
1008
+ 'intersect': intersect_vector_uuid
1009
+ }
1010
+ query = await self._add_params_to_query(query_name='$intersection', inputs=inputs)
1011
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1012
+
1013
+
1014
+ async def join(self,
1015
+ vector1_uuid: str,
1016
+ vector2_uuid: str,
1017
+ vector1_join_column: str,
1018
+ vector2_join_column: str,
1019
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1020
+ """
1021
+ [async] Joins two layers based on specified columns, combining attributes from both tables into one
1022
+
1023
+ Args:
1024
+ vector1_uuid (str): UUID of the first vector layer
1025
+ vector2_uuid (str): UUID of the second vector layer
1026
+ vector1_join_column (str): Join column from first layer
1027
+ vector2_join_column (str): Join column from second layer
1028
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1029
+
1030
+ Returns:
1031
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1032
+
1033
+ Example:
1034
+ >>> from geobox.aio import AsyncGeoboxClient
1035
+ >>> async with AsyncGeoboxClient() as client:
1036
+ >>> vector1 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1037
+ >>> vector2 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1038
+
1039
+ >>> # execution
1040
+ >>> result = await client.vector_tool.join(
1041
+ ... vector1_uuid=vector1.uuid,
1042
+ ... vector2_uuid=vector2.uuid,
1043
+ ... vector1_join_column="vector1_field_name",
1044
+ ... vector2_join_column="vector2_field_name")
1045
+
1046
+ >>> # save as layer
1047
+ >>> task = await client.vector_tool.join(
1048
+ ... vector1_uuid=vector1.uuid,
1049
+ ... vector2_uuid=vector2.uuid,
1050
+ ... vector1_join_column="vector1_field_name",
1051
+ ... vector2_join_column="vector2_field_name",
1052
+ ... output_layer_name="output_layer")
1053
+ >>> await task.wait()
1054
+ >>> output_layer = await task.output_asset
1055
+ """
1056
+ inputs = {
1057
+ 'layer1': vector1_uuid,
1058
+ 'layer2': vector2_uuid,
1059
+ 'layer1_join_column': vector1_join_column,
1060
+ 'layer2_join_column': vector2_join_column
1061
+ }
1062
+ query = await self._add_params_to_query(query_name='$join', inputs=inputs)
1063
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1064
+
1065
+
1066
+ async def lat_lon_to_point(self,
1067
+ latitude: float,
1068
+ longitude: float,
1069
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1070
+ """
1071
+ [async] Converts latitude and longitude values to a point geometry, storing it as a new feature
1072
+
1073
+ Args:
1074
+ latitude (float): Latitude coordinate
1075
+ longitude (float): Longitude coordinate
1076
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1077
+
1078
+ Returns:
1079
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1080
+
1081
+ Example:
1082
+ >>> from geobox.aio import AsyncGeoboxClient
1083
+ >>> async with AsyncGeoboxClient() as client:
1084
+
1085
+ >>> # execution
1086
+ >>> result = await client.vector_tool.lat_lon_to_point(
1087
+ ... latitude=10,
1088
+ ... longitude=10)
1089
+
1090
+ >>> # save as layer
1091
+ >>> task = await client.vector_tool.lat_lon_to_point(
1092
+ ... latitude=10,
1093
+ ... longitude=10,
1094
+ ... output_layer_name="output_layer")
1095
+ >>> await task.wait()
1096
+ >>> output_layer = await task.output_asset
1097
+ """
1098
+ inputs = {
1099
+ 'latitude': latitude,
1100
+ 'longitude': longitude
1101
+ }
1102
+ query = await self._add_params_to_query(query_name='$lat_lon_to_point', inputs=inputs)
1103
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1104
+
1105
+
1106
+ async def layer_bbox(self,
1107
+ vector_uuid: str,
1108
+ srid: int) -> Dict:
1109
+ """
1110
+ [async] Computes the bounding box for all geometries in the layer, outputting it as a single text attribute
1111
+
1112
+ Args:
1113
+ vector_uuid (str): UUID of the vector layer
1114
+ srid (int): SRID for the output bounding box
1115
+
1116
+ Returns:
1117
+ Dict: the vector tool execution result.
1118
+
1119
+ Example:
1120
+ >>> from geobox.aio import AsyncGeoboxClient
1121
+ >>> async with AsyncGeoboxClient() as client:
1122
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1123
+
1124
+ >>> # execution
1125
+ >>> result = client.vector_tool.layer_bbox(vector_uuid=vector.uuid, srid=4326)
1126
+ """
1127
+ inputs = {
1128
+ 'layer': vector_uuid,
1129
+ 'srid': srid
1130
+ }
1131
+ query = await self._add_params_to_query(query_name='$layer_bbox', inputs=inputs)
1132
+ return await self._run_query(query=query)
1133
+
1134
+
1135
+ async def layer_extent(self,
1136
+ vector_uuid: str,
1137
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1138
+ """
1139
+ [async] Calculates the spatial extent of the entire layer, producing a bounding box polygon around all geometries
1140
+
1141
+ Args:
1142
+ vector_uuid (str): UUID of the vector layer
1143
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1144
+
1145
+ Returns:
1146
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1147
+
1148
+ Example:
1149
+ >>> from geobox.aio import AsyncGeoboxClient
1150
+ >>> async with AsyncGeoboxClient() as client:
1151
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1152
+
1153
+ >>> # execution
1154
+ >>> result = await client.vector_tool.layer_extent(vector_uuid=vector.uuid)
1155
+
1156
+ >>> # save as layer
1157
+ >>> task = await client.vector_tool.layer_extent(vector_uuid=vector.uuid, output_layer_name="output_layer")
1158
+ >>> await task.wait()
1159
+ >>> output_layer = await task.output_asset
1160
+ """
1161
+ inputs = {
1162
+ 'layer': vector_uuid
1163
+ }
1164
+ query = await self._add_params_to_query(query_name='$layer_extent', inputs=inputs)
1165
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1166
+
1167
+
1168
+ async def length(self,
1169
+ vector_uuid: str,
1170
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1171
+ """
1172
+ [async] Computes the length of line geometries in the layer, adding it as an attribute for each feature
1173
+
1174
+ Args:
1175
+ vector_uuid (str): UUID of the vector layer
1176
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1177
+
1178
+ Returns:
1179
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1180
+
1181
+ Example:
1182
+ >>> from geobox.aio import AsyncGeoboxClient
1183
+ >>> async with AsyncGeoboxClient() as client:
1184
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1185
+
1186
+ >>> # execution
1187
+ >>> result = await client.vector_tool.length(vector_uuid=vector.uuid)
1188
+
1189
+ >>> # save as layer
1190
+ >>> task = await client.vector_tool.length(vector_uuid=vector.uuid, output_layer_name="output_layer")
1191
+ >>> await task.wait()
1192
+ >>> output_layer = await task.output_asset
1193
+ """
1194
+ inputs = {
1195
+ 'layer': vector_uuid
1196
+ }
1197
+ query = await self._add_params_to_query(query_name='$length', inputs=inputs)
1198
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1199
+
1200
+
1201
+ async def linear_referencing(self,
1202
+ vector_uuid: str,
1203
+ feature_id: int,
1204
+ dist: float,
1205
+ tolerance: float,
1206
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1207
+ """
1208
+ [async] Returns points separated at a specified distance along a line, based on linear referencing techniques
1209
+
1210
+ Args:
1211
+ vector_uuid (str): UUID of the vector layer
1212
+ feature_id (int): ID of the feature to reference
1213
+ dist (float): Distance along the line
1214
+ tolerance (float): Tolerance for point placement
1215
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1216
+
1217
+ Returns:
1218
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1219
+
1220
+ Example:
1221
+ >>> from geobox.aio import AsyncGeoboxClient
1222
+ >>> async with AsyncGeoboxClient() as client:
1223
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1224
+ >>> feature = await vector.get_features()
1225
+
1226
+ >>> # execution
1227
+ >>> result = await client.vector_tool.linear_referencing(
1228
+ ... vector_uuid=vector.uuid,
1229
+ ... feature_id=feature.id,
1230
+ ... dist=10,
1231
+ ... tolerance=10)
1232
+
1233
+ >>> # save as layer
1234
+ >>> task = await client.vector_tool.linear_referencing(
1235
+ ... vector_uuid=vector.uuid,
1236
+ ... feature_id=feature.id,
1237
+ ... dist=10,
1238
+ ... tolerance=10,
1239
+ ... output_layer_name="output_layer")
1240
+ >>> await task.wait()
1241
+ >>> output_layer = await task.output_asset
1242
+ """
1243
+ inputs = {
1244
+ 'layer': vector_uuid,
1245
+ 'feature_id': feature_id,
1246
+ 'dist': dist,
1247
+ 'tolerance': tolerance
1248
+ }
1249
+ query = await self._add_params_to_query(query_name='$linear_referencing', inputs=inputs)
1250
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1251
+
1252
+
1253
+ async def line_to_polygon(self,
1254
+ vector_uuid: str,
1255
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1256
+ """
1257
+ [async] Converts line geometries into polygons by closing the line segments to form closed shapes
1258
+
1259
+ Args:
1260
+ vector_uuid (str): UUID of the vector layer
1261
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1262
+
1263
+ Returns:
1264
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1265
+
1266
+ Example:
1267
+ >>> from geobox.aio import AsyncGeoboxClient
1268
+ >>> async with AsyncGeoboxClient() as client:
1269
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1270
+
1271
+ >>> # execution
1272
+ >>> result = await client.vector_tool.line_to_polygon(vector_uuid=vector.uuid)
1273
+
1274
+ >>> # save as layer
1275
+ >>> task = await client.vector_tool.line_to_polygon(vector_uuid=vector.uuid, output_layer_name="output_layer")
1276
+ >>> await task.wait()
1277
+ >>> output_layer = await task.output_asset
1278
+ """
1279
+ inputs = {
1280
+ 'layer': vector_uuid
1281
+ }
1282
+ query = await self._add_params_to_query(query_name='$line_to_polygon', inputs=inputs)
1283
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1284
+
1285
+
1286
+ async def make_envelop(self,
1287
+ xmin: float,
1288
+ ymin: float,
1289
+ xmax: float,
1290
+ ymax: float,
1291
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1292
+ """
1293
+ [async] Generates a rectangular bounding box based on provided minimum and maximum x and y coordinates
1294
+
1295
+ Args:
1296
+ xmin (float): Minimum x coordinate
1297
+ ymin (float): Minimum y coordinate
1298
+ xmax (float): Maximum x coordinate
1299
+ ymax (float): Maximum y coordinate
1300
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1301
+
1302
+ Returns:
1303
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1304
+
1305
+ Example:
1306
+ >>> from geobox.aio import AsyncGeoboxClient
1307
+ >>> async with AsyncGeoboxClient() as client:
1308
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1309
+
1310
+ >>> # execution
1311
+ >>> result = await client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10)
1312
+
1313
+ >>> # save as layer
1314
+ >>> task = await client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10, output_layer_name="output_layer")
1315
+ >>> await task.wait()
1316
+ >>> output_layer = await task.output_asset
1317
+ """
1318
+ inputs = {
1319
+ 'xmin': xmin,
1320
+ 'ymin': ymin,
1321
+ 'xmax': xmax,
1322
+ 'ymax': ymax,
1323
+ }
1324
+ query = await self._add_params_to_query(query_name='$make_envelop', inputs=inputs)
1325
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1326
+
1327
+
1328
+ async def merge(self,
1329
+ vector1_uuid: str,
1330
+ vector2_uuid: str,
1331
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1332
+ """
1333
+ [async] Combines two layers into one by uniting their attributes and geometries, forming a single cohesive layer
1334
+
1335
+ Args:
1336
+ vector1_uuid (str): UUID of the first vector layer
1337
+ vector2_uuid (str): UUID of the second vector layer
1338
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1339
+
1340
+ Returns:
1341
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1342
+
1343
+ Example:
1344
+ >>> from geobox.aio import AsyncGeoboxClient
1345
+ >>> async with AsyncGeoboxClient() as client:
1346
+ >>> vector1 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1347
+ >>> vector2 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1348
+
1349
+ >>> # execution
1350
+ >>> result = await client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid)
1351
+
1352
+ >>> # save as layer
1353
+ >>> task = await client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid, output_layer_name="output_layer")
1354
+ >>> await task.wait()
1355
+ >>> output_layer = await task.output_asset
1356
+ """
1357
+ inputs = {
1358
+ 'layer1': vector1_uuid,
1359
+ 'layer2': vector2_uuid
1360
+ }
1361
+ query = await self._add_params_to_query(query_name='$merge', inputs=inputs)
1362
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1363
+
1364
+
1365
+ async def network_trace(self,
1366
+ vector_uuid: str,
1367
+ from_id: int,
1368
+ direction: NetworkTraceDirection,
1369
+ tolerance: float,
1370
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1371
+ """
1372
+ [async] Performs a recursive spatial network trace, traversing connected lines based on specified direction and tolerance
1373
+
1374
+ Args:
1375
+ vector_uuid (str): UUID of the vector layer
1376
+ from_id (int): Starting feature ID for the trace
1377
+ direction (NetworkTraceDirection): Direction of trace: UP(upstream) or DOWN(downstream)
1378
+ tolerance (float): Tolerance for network connectivity
1379
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1380
+
1381
+ Returns:
1382
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1383
+
1384
+ Example:
1385
+ >>> from geobox.aio import AsyncGeoboxClient
1386
+ >>> async with AsyncGeoboxClient() as client:
1387
+ >>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1388
+
1389
+ >>> # execution
1390
+ >>> result = await client.vector_tool.network_trace(
1391
+ ... vector_uuid=vector1.uuid,
1392
+ ... from_id=10,
1393
+ ... direction=NetworkTraceDirection.UP,
1394
+ ... tolerance=10)
1395
+
1396
+ >>> # save as layer
1397
+ >>> task = await client.vector_tool.network_trace(
1398
+ ... vector_uuid=vector1.uuid,
1399
+ ... from_id=10,
1400
+ ... direction=NetworkTraceDirection.UP,
1401
+ ... tolerance=10),
1402
+ ... output_layer_name="output_layer")
1403
+ >>> await task.wait()
1404
+ >>> output_layer = await task.output_asset
1405
+ """
1406
+ inputs = {
1407
+ 'layer': vector_uuid,
1408
+ 'from_id': from_id,
1409
+ 'direction': direction,
1410
+ 'tolerance': tolerance
1411
+ }
1412
+ query = await self._add_params_to_query(query_name='$network_trace', inputs=inputs)
1413
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1414
+
1415
+
1416
+ async def number_of_geoms(self,
1417
+ vector_uuid: str,
1418
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1419
+ """
1420
+ [async] Counts the number of geometry parts in each multi-part shape, adding this count as a new column
1421
+
1422
+ Args:
1423
+ vector_uuid (str): UUID of the vector layer
1424
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1425
+
1426
+ Returns:
1427
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1428
+
1429
+ Example:
1430
+ >>> from geobox.aio import AsyncGeoboxClient
1431
+ >>> async with AsyncGeoboxClient() as client:
1432
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1433
+
1434
+ >>> # execution
1435
+ >>> result = await client.vector_tool.number_of_geoms(vector_uuid=vector.uuid)
1436
+
1437
+ >>> # save as layer
1438
+ >>> task = await client.vector_tool.number_of_geoms(vector_uuid=vector.uuid, output_layer_name="output_layer")
1439
+ >>> await task.wait()
1440
+ >>> output_layer = await task.output_asset
1441
+ """
1442
+ inputs = {
1443
+ 'layer': vector_uuid
1444
+ }
1445
+ query = await self._add_params_to_query(query_name='$number_of_geoms', inputs=inputs)
1446
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1447
+
1448
+
1449
+ async def number_of_points(self,
1450
+ vector_uuid: str,
1451
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1452
+ """
1453
+ [async] Counts the number of vertices in each geometry, providing an attribute with this point count
1454
+
1455
+ Args:
1456
+ vector_uuid (str): UUID of the vector layer
1457
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1458
+
1459
+ Returns:
1460
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1461
+
1462
+ Example:
1463
+ >>> from geobox.aio import AsyncGeoboxClient
1464
+ >>> async with AsyncGeoboxClient() as client:
1465
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1466
+
1467
+ >>> # execution
1468
+ >>> result = await client.vector_tool.number_of_points(vector_uuid=vector.uuid)
1469
+
1470
+ >>> # save as layer
1471
+ >>> task = await client.vector_tool.number_of_points(vector_uuid=vector.uuid, output_layer_name="output_layer")
1472
+ >>> await task.wait()
1473
+ >>> output_layer = await task.output_asset
1474
+ """
1475
+ inputs = {
1476
+ 'layer': vector_uuid
1477
+ }
1478
+ query = await self._add_params_to_query(query_name='$number_of_points', inputs=inputs)
1479
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1480
+
1481
+
1482
+ async def point_stats_in_polygon(self,
1483
+ polygon_vector_uuid: str,
1484
+ point_vector_uuid: str,
1485
+ stats_column: str,
1486
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1487
+ """
1488
+ [async] Aggregates statistical data for points within each polygon, calculating sum, average, minimum, and maximum
1489
+
1490
+ Args:
1491
+ polygon_vector_uuid (str): UUID of the polygon layer
1492
+ point_vector_uuid (str): UUID of the point layer
1493
+ stats_column (str): Column to calculate statistics on
1494
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1495
+
1496
+ Returns:
1497
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1498
+
1499
+ Example:
1500
+ >>> from geobox.aio import AsyncGeoboxClient
1501
+ >>> async with AsyncGeoboxClient() as client:
1502
+ >>> polygon_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1503
+ >>> point_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1504
+
1505
+ >>> # execution
1506
+ >>> result = await client.vector_tool.point_stats_in_polygon(
1507
+ ... polygon_vector_uuid=polygon_vector.uuid,
1508
+ ... point_vector_uuid=point_vector.uuid,
1509
+ ... stats_column="field_name")
1510
+
1511
+ >>> # save as layer
1512
+ >>> task = await client.vector_tool.point_stats_in_polygon(
1513
+ ... polygon_vector_uuid=polygon_vector.uuid,
1514
+ ... point_vector_uuid=point_vector.uuid,
1515
+ ... stats_column="field_name"),
1516
+ ... output_layer_name="output_layer")
1517
+ >>> await task.wait()
1518
+ >>> output_layer = await task.output_asset
1519
+ """
1520
+ inputs = {
1521
+ 'polygon_layer': polygon_vector_uuid,
1522
+ 'point_layer': point_vector_uuid,
1523
+ 'stats_column': stats_column
1524
+ }
1525
+ query = await self._add_params_to_query(query_name='$point_stats_in_polygon', inputs=inputs)
1526
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1527
+
1528
+
1529
+ async def remove_holes(self,
1530
+ vector_uuid: str,
1531
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1532
+ """
1533
+ [async] Removes interior holes from polygon geometries, leaving only the outer boundary of each shape
1534
+
1535
+ Args:
1536
+ vector_uuid (str): UUID of the vector layer
1537
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1538
+
1539
+ Returns:
1540
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1541
+
1542
+ Example:
1543
+ >>> from geobox.aio import AsyncGeoboxClient
1544
+ >>> async with AsyncGeoboxClient() as client:
1545
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1546
+
1547
+ >>> # execution
1548
+ >>> result = await client.vector_tool.remove_holes(vector_uuid=vector.uuid)
1549
+
1550
+ >>> # save as layer
1551
+ >>> task = await client.vector_tool.remove_holes(vector_uuid=vector.uuid, output_layer_name="output_layer")
1552
+ >>> await task.wait()
1553
+ >>> output_layer = await task.output_asset
1554
+ """
1555
+ inputs = {
1556
+ 'layer': vector_uuid
1557
+ }
1558
+ query = await self._add_params_to_query(query_name='$remove_holes', inputs=inputs)
1559
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1560
+
1561
+
1562
+ async def reverse_line(self,
1563
+ vector_uuid: str,
1564
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1565
+ """
1566
+ [async] Reverses the direction of line geometries, swapping start and end points of each line
1567
+
1568
+ Args:
1569
+ vector_uuid (str): UUID of the vector layer
1570
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1571
+
1572
+ Returns:
1573
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1574
+
1575
+ Example:
1576
+ >>> from geobox.aio import AsyncGeoboxClient
1577
+ >>> async with AsyncGeoboxClient() as client:
1578
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1579
+
1580
+ >>> # execution
1581
+ >>> result = await client.vector_tool.reverse_line(vector_uuid=vector.uuid)
1582
+
1583
+ >>> # save as layer
1584
+ >>> task = await client.vector_tool.reverse_line(vector_uuid=vector.uuid, output_layer_name="output_layer")
1585
+ >>> await task.wait()
1586
+ >>> output_layer = await task.output_asset
1587
+ """
1588
+ inputs = {
1589
+ 'layer': vector_uuid
1590
+ }
1591
+ query = await self._add_params_to_query(query_name='$reverse_line', inputs=inputs)
1592
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1593
+
1594
+
1595
+ async def simplify(self,
1596
+ vector_uuid: str,
1597
+ tolerance: float,
1598
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1599
+ """
1600
+ [async] Simplifies geometries based on a tolerance value, reducing detail while preserving general shape
1601
+
1602
+ Args:
1603
+ vector_uuid (str): UUID of the vector layer
1604
+ tolerance (float): Simplification tolerance
1605
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1606
+
1607
+ Returns:
1608
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1609
+
1610
+ Example:
1611
+ >>> from geobox.aio import AsyncGeoboxClient
1612
+ >>> async with AsyncGeoboxClient() as client:
1613
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1614
+
1615
+ >>> # execution
1616
+ >>> result = await client.vector_tool.simplify(
1617
+ ... vector_uuid=vector.uuid
1618
+ ... tolerance=10)
1619
+
1620
+ >>> # save as layer
1621
+ >>> task = await client.vector_tool.simplify(
1622
+ ... vector_uuid=vector.uuid
1623
+ ... tolerance=10,
1624
+ ... output_layer_name="output_layer")
1625
+ >>> await task.wait()
1626
+ >>> output_layer = await task.output_asset
1627
+ """
1628
+ inputs = {
1629
+ 'layer': vector_uuid,
1630
+ 'tolerance': tolerance
1631
+ }
1632
+ query = await self._add_params_to_query(query_name='$simplify', inputs=inputs)
1633
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1634
+
1635
+
1636
+ async def snap_to_grid(self,
1637
+ vector_uuid: str,
1638
+ grid_size: float,
1639
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1640
+ """
1641
+ [async] Aligns geometries to a grid of a specified size, rounding coordinates to fall on the grid lines
1642
+
1643
+ Args:
1644
+ vector_uuid (str): UUID of the vector layer
1645
+ grid_size (float): Size of the grid cells
1646
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1647
+
1648
+ Returns:
1649
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1650
+
1651
+ Example:
1652
+ >>> from geobox.aio import AsyncGeoboxClient
1653
+ >>> async with AsyncGeoboxClient() as client:
1654
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1655
+
1656
+ >>> # execution
1657
+ >>> result = await client.vector_tool.snap_to_grid(
1658
+ ... vector_uuid=vector.uuid
1659
+ ... grid_size=10)
1660
+
1661
+ >>> # save as layer
1662
+ >>> task = await client.vector_tool.snap_to_grid(
1663
+ ... vector_uuid=vector.uuid
1664
+ ... grid_size=10,
1665
+ ... output_layer_name="output_layer")
1666
+ >>> await task.wait()
1667
+ >>> output_layer = await task.output_asset
1668
+ """
1669
+ inputs = {
1670
+ 'layer': vector_uuid,
1671
+ 'grid_size': grid_size
1672
+ }
1673
+ query = await self._add_params_to_query(query_name='$snap_to_grid', inputs=inputs)
1674
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1675
+
1676
+
1677
+ async def spatial_aggregation(self,
1678
+ vector_uuid: str,
1679
+ agg_function: 'SpatialAggFunction',
1680
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1681
+ """
1682
+ [async] Aggregates geometries by performing spatial functions like union or extent on all geometries in the layer
1683
+
1684
+ Args:
1685
+ vector_uuid (str): UUID of the vector layer
1686
+ agg_function (SpatialAggFunction): Aggregation function: collect, union, extent, makeline
1687
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1688
+
1689
+ Returns:
1690
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1691
+
1692
+ Example:
1693
+ >>> from geobox.aio import AsyncGeoboxClient
1694
+ >>> from geobox.vector_tool import SpatialAggFunction
1695
+ >>> async with AsyncGeoboxClient() as client:
1696
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1697
+
1698
+ >>> # execution
1699
+ >>> result = await client.vector_tool.spatial_aggregation(
1700
+ ... vector_uuid=vector.uuid
1701
+ ... agg_function=SpatialAggFunction.COLLECT)
1702
+
1703
+ >>> # save as layer
1704
+ >>> task = await client.vector_tool.spatial_aggregation(
1705
+ ... vector_uuid=vector.uuid
1706
+ ... agg_function=SpatialAggFunction.COLLECT,
1707
+ ... output_layer_name="output_layer")
1708
+ >>> await task.wait()
1709
+ >>> output_layer = await task.output_asset
1710
+ """
1711
+ inputs = {
1712
+ 'layer': vector_uuid,
1713
+ 'agg_function': agg_function
1714
+ }
1715
+ query = await self._add_params_to_query(query_name='$spatial_aggregation', inputs=inputs)
1716
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1717
+
1718
+
1719
+ async def spatial_filter(self,
1720
+ vector_uuid: str,
1721
+ spatial_predicate: 'SpatialPredicate',
1722
+ filter_vector_uuid: str,
1723
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1724
+ """
1725
+ [async] Filters features in a layer based on spatial relationships with a filter layer, such as intersects, contains, or within
1726
+
1727
+ Args:
1728
+ vector_uuid (str): UUID of the vector layer
1729
+ spatial_predicate (SpatialPredicate): Spatial predicate: Intersect, Contain, Cross, Equal, Overlap, Touch, Within
1730
+ filter_vector_uuid (str): UUID of the filter layer
1731
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1732
+
1733
+ Returns:
1734
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1735
+
1736
+ Example:
1737
+ >>> from geobox.aio import AsyncGeoboxClient
1738
+ >>> from geobox.vector_tool import SpatialAggFunction
1739
+ >>> async with AsyncGeoboxClient() as client:
1740
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1741
+ >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1742
+
1743
+ >>> # execution
1744
+ >>> result = await client.vector_tool.spatial_filter(
1745
+ ... vector_uuid=vector.uuid
1746
+ ... spatial_predicate=SpatialPredicate.INTERSECT,
1747
+ ... filter_vector_uuid=filter_vector.uuid)
1748
+
1749
+ >>> # save as layer
1750
+ >>> task = await client.vector_tool.spatial_filter(
1751
+ ... vector_uuid=vector.uuid
1752
+ ... spatial_predicate=SpatialPredicate.INTERSECT,
1753
+ ... filter_vector_uuid=filter_vector.uuid,
1754
+ ... output_layer_name="output_layer")
1755
+ >>> await task.wait()
1756
+ >>> output_layer = await task.output_asset
1757
+ """
1758
+ inputs = {
1759
+ 'layer': vector_uuid,
1760
+ 'spatial_predicate': spatial_predicate,
1761
+ 'filter_layer': filter_vector_uuid
1762
+ }
1763
+ query = await self._add_params_to_query(query_name='$spatial_filter', inputs=inputs)
1764
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1765
+
1766
+
1767
+ async def spatial_group_by(self,
1768
+ vector_uuid: str,
1769
+ group_column_name: str,
1770
+ agg_function: 'SpatialAggFunction',
1771
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1772
+ """
1773
+ [async] Groups geometries by a specified column and aggregates them using spatial functions like union, collect, or extent
1774
+
1775
+ Args:
1776
+ vector_uuid (str): UUID of the vector layer
1777
+ group_column_name (str): Column to group by
1778
+ agg_function (SpatialAggFunction): Spatial aggregation function: collect, union, extent, makeline
1779
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1780
+
1781
+ Returns:
1782
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1783
+
1784
+ Example:
1785
+ >>> from geobox.aio import AsyncGeoboxClient
1786
+ >>> from geobox.vector_tool import GroupByAggFunction
1787
+ >>> async with AsyncGeoboxClient() as client:
1788
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1789
+
1790
+ >>> # execution
1791
+ >>> result = await client.vector_tool.spatial_group_by(
1792
+ ... vector_uuid=vector.uuid,
1793
+ ... group_column_name="field_1",
1794
+ ... agg_function=SpatialAggFunction.COLLECT)
1795
+
1796
+ >>> # save as layer
1797
+ >>> task = await client.vector_tool.spatial_group_by(
1798
+ ... vector_uuid=vector.uuid,
1799
+ ... group_column_name="field_1",
1800
+ ... agg_function=SpatialAggFunction.COLLECT,
1801
+ ... output_layer_name="output_layer")
1802
+ >>> await task.wait()
1803
+ >>> output_layer = await task.output_asset
1804
+ """
1805
+ inputs = {
1806
+ 'layer': vector_uuid,
1807
+ 'group_column': group_column_name,
1808
+ 'agg_function': agg_function.value
1809
+ }
1810
+ query = await self._add_params_to_query(query_name='$spatial_group_by', inputs=inputs)
1811
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1812
+
1813
+
1814
+ async def square_grid(self,
1815
+ vector_uuid: str,
1816
+ cell_size: float,
1817
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1818
+ """
1819
+ [async] Generates a square grid across the layer extent, counting how many geometries intersect each square cell
1820
+
1821
+ Args:
1822
+ vector_uuid (str): UUID of the vector layer
1823
+ cell_size (float): Size of square grid cells
1824
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1825
+
1826
+ Returns:
1827
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1828
+
1829
+ Example:
1830
+ >>> from geobox.aio import AsyncGeoboxClient
1831
+ >>> async with AsyncGeoboxClient() as client:
1832
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1833
+
1834
+ >>> # execution
1835
+ >>> result = await client.vector_tool.square_grid(
1836
+ ... vector_uuid=vector.uuid,
1837
+ ... cell_size=10)
1838
+
1839
+ >>> # save as layer
1840
+ >>> task = await client.vector_tool.square_grid(
1841
+ ... vector_uuid=vector.uuid,
1842
+ ... cell_size=10,
1843
+ ... output_layer_name="output_layer")
1844
+ >>> await task.wait()
1845
+ >>> output_layer = await task.output_asset
1846
+ """
1847
+ inputs = {
1848
+ 'layer': vector_uuid,
1849
+ 'cell_size': cell_size
1850
+ }
1851
+ query = await self._add_params_to_query(query_name='$square_grid', inputs=inputs)
1852
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1853
+
1854
+
1855
+ async def voronoi_polygons(self,
1856
+ vector_uuid: str,
1857
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1858
+ """
1859
+ [async] Creates Voronoi polygons from input points, partitioning the space so each polygon surrounds a unique point
1860
+
1861
+ Args:
1862
+ vector_uuid (str): UUID of the vector layer
1863
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1864
+
1865
+ Returns:
1866
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1867
+
1868
+ Example:
1869
+ >>> from geobox.aio import AsyncGeoboxClient
1870
+ >>> async with AsyncGeoboxClient() as client:
1871
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1872
+
1873
+ >>> # execution
1874
+ >>> result = await client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid)
1875
+
1876
+ >>> # save as layer
1877
+ >>> task = await client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid, output_layer_name="output_layer")
1878
+ >>> await task.wait()
1879
+ >>> output_layer = await task.output_asset
1880
+ """
1881
+ inputs = {
1882
+ 'layer': vector_uuid
1883
+ }
1884
+ query = await self._add_params_to_query(query_name='$voronoi_polygons', inputs=inputs)
1885
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1886
+
1887
+
1888
+ async def within_distance(self,
1889
+ vector_uuid: str,
1890
+ filter_vector_uuid: str,
1891
+ dist: float,
1892
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1893
+ """
1894
+ [async] Filters geometries that are within a specified distance of a filter layer, useful for proximity analysis
1895
+
1896
+ Args:
1897
+ vector_uuid (str): UUID of the vector layer
1898
+ filter_vector_uuid (str): UUID of the filter layer
1899
+ dist (float): Search distance
1900
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1901
+
1902
+ Returns:
1903
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1904
+
1905
+ Example:
1906
+ >>> from geobox.aio import AsyncGeoboxClient
1907
+ >>> async with AsyncGeoboxClient() as client:
1908
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1909
+ >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1910
+
1911
+ >>> # execution
1912
+ >>> result = await client.vector_tool.within_distance(
1913
+ ... vector_uuid=vector.uuid,
1914
+ ... filter_vector_uuid=filter_vector=filter_vector.uuid,
1915
+ ... dist=10)
1916
+
1917
+ >>> # save as layer
1918
+ >>> task = await client.vector_tool.within_distance(
1919
+ ... vector_uuid=vector.uuid,
1920
+ ... filter_vector_uuid=filter_vector=filter_vector.uuid,
1921
+ ... dist=10,
1922
+ ... output_layer_name="output_layer")
1923
+ >>> await task.wait()
1924
+ >>> output_layer = await task.output_asset
1925
+ """
1926
+ inputs = {
1927
+ 'layer': vector_uuid,
1928
+ 'filter_layer': filter_vector_uuid,
1929
+ 'dist': dist
1930
+ }
1931
+ query = await self._add_params_to_query(query_name='$within_distance', inputs=inputs)
1932
+ return await self._run_query(query=query, output_layer_name=output_layer_name)
1933
+
1934
+
1935
+ async def xy_coordinate(self,
1936
+ vector_uuid: str,
1937
+ srid: Optional[int] = AsyncFeature.BASE_SRID,
1938
+ output_layer_name: Optional[str] = None) -> Union['AsyncTask', Dict]:
1939
+ """
1940
+ [async] Extracts the X and Y coordinates for each geometry in a layer, adding coord_x and coord_y columns
1941
+
1942
+ Args:
1943
+ vector_uuid (str): UUID of the vector layer
1944
+ srid (int, optional): SRID for coordinate extraction. default: 3857
1945
+ output_layer_name (str, optional): Name for the output layer. name must be a valid identifier and without spacing.
1946
+
1947
+ Returns:
1948
+ Union['AsyncTask', Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
1949
+
1950
+ Example:
1951
+ >>> from geobox.aio import AsyncGeoboxClient
1952
+ >>> async with AsyncGeoboxClient() as client:
1953
+ >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
1954
+
1955
+ >>> # execution
1956
+ >>> result = await client.vector_tool.xy_coordinate(vector_uuid=vector.uuid)
1957
+
1958
+ >>> # save as layer
1959
+ >>> task = await client.vector_tool.xy_coordinate(vector_uuid=vector.uuid, output_layer_name="output_layer")
1960
+ >>> await task.wait()
1961
+ >>> output_layer = await task.output_asset
1962
+ """
1963
+ inputs = {
1964
+ 'layer': vector_uuid,
1965
+ 'srid': srid
1966
+ }
1967
+ query = await self._add_params_to_query(query_name='$xy_coordinate', inputs=inputs)
1968
+ return await self._run_query(query=query, output_layer_name=output_layer_name)