Async Vector Tool
The async VectorTool module provides functionality for working with 50 vector processing tools.
- class AsyncVectorTool(api)[source]
Bases:
AsyncBase- Parameters:
api (AsyncGeoboxClient)
- BASE_ENDPOINT = 'queries/'
- __init__(api)[source]
Initialize an async VectorTool instance.
- Parameters:
api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.
- async _add_params_to_query(query_name, inputs)[source]
add user input params to the query
- Parameters:
query_name (str)
inputs (dict)
- Return type:
- async _run_query(query, output_layer_name=None)[source]
execute or save as layer
- Parameters:
query (AsyncQuery)
output_layer_name (str | None)
- Return type:
AsyncTask | Dict
- async area(vector_uuid, output_layer_name=None)[source]
[async] Computes and adds a new column for the area of each polygon in the layer, aiding in spatial measurements
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.area(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.area(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async as_geojson(vector_uuid, output_layer_name=None)[source]
[async] Converts geometries to GeoJSON format, adding a column with GeoJSON strings for each geometry in the layer
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.as_geojson(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.as_geojson(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async as_wkt(vector_uuid, output_layer_name=None)[source]
[async] Converts geometries into WKT (Well-Known Text) format, storing it as a new column in the layer
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.as_wkt(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.as_wkt(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async buffer(vector_uuid, distance, output_layer_name=None)[source]
[async] Generates a buffer zone around each geometry in the layer, expanding each shape by a specified distance
- Parameters:
vector_uuid (str) – UUID of the vector layer
distance (float) – Buffer distance
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000)
>>> # save as layer >>> task = await client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async centroid(vector_uuid, output_layer_name=None)[source]
[async] Calculates the centroid point of each geometry, which represents the geometric center of each shape
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.centroid(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.centroid(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async clip(vector_uuid, clip_vector_uuid, output_layer_name=None)[source]
[async] Clips geometries and retains only the parts of the geometries that fall within the specified boundaries
- Parameters:
vector_uuid (str) – UUID of the vector layer
clip_vector_uuid (str) – UUID of the clip vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> clip_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async concave_hull(vector_uuid, tolerance, output_layer_name=None)[source]
[async] Creates a concave hull (a polygon that closely wraps around all geometries) for the layer with a specified tolerance
- Parameters:
vector_uuid (str) – UUID of the vector layer
tolerance (float) – Tolerance parameter for concave hull
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10)
>>> # save as layer >>> task = await client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async convex_hull(vector_uuid, output_layer_name=None)[source]
[async] Calculates a convex hull for all geometries in a layer, creating a polygon that minimally contains all points or shapes
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.convex_hull(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.convex_hull(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async feature_count(vector_uuid)[source]
[async] Counts the total number of rows in the specified layer, which is useful for data volume estimation
- Parameters:
vector_uuid (str) – UUID of the vector layer
- Returns:
the vector tool execution result.
- Return type:
Dict
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.feature_count(vector_uuid=vector.uuid)
- async count_point_in_polygons(polygon_vector_uuid, point_vector_uuid, output_layer_name=None)[source]
[async] Counts the number of points within each polygon, giving a density measure of points per polygon
- Parameters:
polygon_vector_uuid (str) – UUID of the polygon layer
point_vector_uuid (str) – UUID of the point layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> polygon_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> point_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.count_point_in_polygons( ... polygon_vector_uuid=polygon_vector.uuid, ... point_vector_uuid=point_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.count_point_in_polygons( ... polygon_vector_uuid=polygon_vector.uuid, ... point_vector_uuid=point_vector.uuid, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async delaunay_triangulation(vector_uuid, output_layer_name=None)[source]
[async] Generates Delaunay triangles from points, creating a tessellated network of polygons from input points
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async disjoint(vector_uuid, filter_vector_uuid, output_layer_name=None)[source]
[async] Filters geometries that do not intersect with another layer, creating a subset with only disjoint geometries
- Parameters:
vector_uuid (str) – UUID of the vector layer
filter_vector_uuid (str) – UUID of the filter layer
output_layer_name (str) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async dissolve(vector_uuid, dissolve_field_name, output_layer_name=None)[source]
[async] Combines geometries based on a specified attribute, grouping them into single shapes for each unique attribute value
- Parameters:
vector_uuid (str) – UUID of the vector layer
dissolve_field_name (str) – Field to dissolve by
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name")
>>> # save as layer >>> task = await client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name", output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async distance_to_nearest(vector_uuid, nearest_vector_uuid, search_radius, output_layer_name=None)[source]
[async] Calculates the minimum distance between geometries in one layer and their nearest neighbors in another
- Parameters:
vector_uuid (str) – UUID of the vector layer
nearest_vector_uuid (str) – UUID of the nearest layer
search_radius (float) – Search radius for nearest features
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> nearest_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.distance_to_nearest( ... vector_uuid=vector.uuid, ... nearest_vector_uuid=nearest_vector.uuid, ... search_radius=10)
>>> # save as layer >>> task = await client.vector_tool.distance_to_nearest( ... vector_uuid=vector.uuid, ... nearest_vector_uuid=nearest_vector.uuid, ... search_radius=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async distinct(vector_uuid, output_layer_name=None)[source]
[async] Selects only unique rows from the input layer, removing duplicate entries across columns
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.distinct(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.distinct(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async dump(vector_uuid, output_layer_name=None)[source]
[async] Splits multi-part geometries into single-part geometries, producing individual shapes from complex collections
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.dump(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.dump(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async erase(vector_uuid, erase_vector_uuid, output_layer_name=None)[source]
[async] Removes portions of geometries that intersect with a specified erase layer, leaving only the non-overlapping parts
- Parameters:
vector_uuid (str) – UUID of the vector layer
erase_vector_uuid (str) – UUID of the erase layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> erase_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async feature_bbox(vector_uuid, srid, output_layer_name=None)[source]
[async] Adds a bounding box column to each feature, showing the min/max x and y coordinates as a text representation
- Parameters:
vector_uuid (str) – UUID of the vector layer
srid (int) – SRID for the output bounding boxes
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326)
>>> # save as layer >>> task = await client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async feature_extent(vector_uuid, output_layer_name=None)[source]
[async] Produces bounding boxes for each feature in the layer, representing the spatial extent of each geometry as a polygon
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.feature_extent(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.feature_extent(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async find_and_replace(vector_uuid, find, replace, output_layer_name=None)[source]
[async] Finds and replaces specified text in a column, updating values based on input patterns
- Parameters:
vector_uuid (str) – UUID of the vector layer
find (str) – Text to find
replace (str) – Text to replace with
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example")
>>> # save as layer >>> task = await client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example", output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async from_geojson(vector_uuid, json_field_name, output_layer_name=None)[source]
[async] Converts GeoJSON strings in a specified column to geometries, adding these as a new column in the layer
- Parameters:
vector_uuid (str) – UUID of the vector layer
json_field_name (str) – Name of the column containing GeoJSON strings
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field")
>>> # save as layer >>> task = await client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field", output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async from_wkt(vector_uuid, wkt_column_name, srid, output_layer_name=None)[source]
[async] Converts WKT strings in a specified column to geometries, adding them as a new column in the layer
- Parameters:
vector_uuid (str) – UUID of the vector layer
wkt_column_name (str) – Name of the column containing WKT strings
srid (int) – SRID for the output geometries
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field")
>>> # save as layer >>> task = await client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field", output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async generate_points(vector_uuid, number_of_points, seed, output_layer_name=None)[source]
[async] Generates random points within each polygon, creating a specified number of points for each geometry
- Parameters:
vector_uuid (str) – UUID of the vector layer
number_of_points (int) – Number of points to generate per polygon
seed (int) – Random seed for reproducible results
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10)
>>> # save as layer >>> task = await client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async group_by(vector_uuid, group_column_name, agg_column_name, agg_function, output_layer_name=None)[source]
[async] Groups the layer by a specified column, applying aggregation functions like count, sum, min, max, and average
- Parameters:
vector_uuid (str) – UUID of the vector layer
group_column_name (str) – Column to group by
agg_column_name (str) – Column to aggregate
agg_function (GroupByAggFunction) – Aggregation function: count, sum, min, max, avg
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geobox.vector_tool import GroupByAggFunction >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.group_by( ... vector_uuid=vector.uuid, ... group_column_name="field_1", ... agg_column_name="field_2", ... agg_function=GroupByAggFunction.SUM)
>>> # save as layer >>> task = await client.vector_tool.group_by( ... vector_uuid=vector.uuid, ... group_column_name="field_1", ... agg_column_name="field_2", ... agg_function=GroupByAggFunction.SUM, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async hexagon_grid(vector_uuid, cell_size, output_layer_name=None)[source]
[async] Creates a grid of hexagons over the layer extent, counting the number of features intersecting each hexagon
- Parameters:
vector_uuid (str) – UUID of the vector layer
cell_size (float) – Size of hexagon cells
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.hexagon_grid( ... vector_uuid=vector.uuid, ... cell_size=10)
>>> # save as layer >>> task = await client.vector_tool.hexagon_grid( ... vector_uuid=vector.uuid, ... cell_size=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async intersection(vector_uuid, intersect_vector_uuid, output_layer_name=None)[source]
[async] Calculates intersections between geometries in two layers, retaining only overlapping portions
- Parameters:
vector_uuid (str) – UUID of the vector layer
intersect_vector_uuid (str) – UUID of the intersect layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> intersect_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.hexagon_grid( ... vector_uuid=vector.uuid, ... intersect_vector_uuid=intersect_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.hexagon_grid( ... vector_uuid=vector.uuid, ... intersect_vector_uuid=intersect_vector.uuid, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async join(vector1_uuid, vector2_uuid, vector1_join_column, vector2_join_column, output_layer_name=None)[source]
[async] Joins two layers based on specified columns, combining attributes from both tables into one
- Parameters:
vector1_uuid (str) – UUID of the first vector layer
vector2_uuid (str) – UUID of the second vector layer
vector1_join_column (str) – Join column from first layer
vector2_join_column (str) – Join column from second layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector1 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> vector2 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.join( ... vector1_uuid=vector1.uuid, ... vector2_uuid=vector2.uuid, ... vector1_join_column="vector1_field_name", ... vector2_join_column="vector2_field_name")
>>> # save as layer >>> task = await client.vector_tool.join( ... vector1_uuid=vector1.uuid, ... vector2_uuid=vector2.uuid, ... vector1_join_column="vector1_field_name", ... vector2_join_column="vector2_field_name", ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async lat_lon_to_point(latitude, longitude, output_layer_name=None)[source]
[async] Converts latitude and longitude values to a point geometry, storing it as a new feature
- Parameters:
latitude (float) – Latitude coordinate
longitude (float) – Longitude coordinate
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client:
>>> # execution >>> result = await client.vector_tool.lat_lon_to_point( ... latitude=10, ... longitude=10)
>>> # save as layer >>> task = await client.vector_tool.lat_lon_to_point( ... latitude=10, ... longitude=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async layer_bbox(vector_uuid, srid)[source]
[async] Computes the bounding box for all geometries in the layer, outputting it as a single text attribute
- Parameters:
vector_uuid (str) – UUID of the vector layer
srid (int) – SRID for the output bounding box
- Returns:
the vector tool execution result.
- Return type:
Dict
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = client.vector_tool.layer_bbox(vector_uuid=vector.uuid, srid=4326)
- async layer_extent(vector_uuid, output_layer_name=None)[source]
[async] Calculates the spatial extent of the entire layer, producing a bounding box polygon around all geometries
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.layer_extent(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.layer_extent(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async length(vector_uuid, output_layer_name=None)[source]
[async] Computes the length of line geometries in the layer, adding it as an attribute for each feature
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.length(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.length(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async linear_referencing(vector_uuid, feature_id, dist, tolerance, output_layer_name=None)[source]
[async] Returns points separated at a specified distance along a line, based on linear referencing techniques
- Parameters:
vector_uuid (str) – UUID of the vector layer
feature_id (int) – ID of the feature to reference
dist (float) – Distance along the line
tolerance (float) – Tolerance for point placement
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> feature = await vector.get_features()
>>> # execution >>> result = await client.vector_tool.linear_referencing( ... vector_uuid=vector.uuid, ... feature_id=feature.id, ... dist=10, ... tolerance=10)
>>> # save as layer >>> task = await client.vector_tool.linear_referencing( ... vector_uuid=vector.uuid, ... feature_id=feature.id, ... dist=10, ... tolerance=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async line_to_polygon(vector_uuid, output_layer_name=None)[source]
[async] Converts line geometries into polygons by closing the line segments to form closed shapes
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.line_to_polygon(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.line_to_polygon(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async make_envelop(xmin, ymin, xmax, ymax, output_layer_name=None)[source]
[async] Generates a rectangular bounding box based on provided minimum and maximum x and y coordinates
- Parameters:
xmin (float) – Minimum x coordinate
ymin (float) – Minimum y coordinate
xmax (float) – Maximum x coordinate
ymax (float) – Maximum y coordinate
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10)
>>> # save as layer >>> task = await client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async merge(vector1_uuid, vector2_uuid, output_layer_name=None)[source]
[async] Combines two layers into one by uniting their attributes and geometries, forming a single cohesive layer
- Parameters:
vector1_uuid (str) – UUID of the first vector layer
vector2_uuid (str) – UUID of the second vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
Returns – Union[‘AsyncTask’, Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
AsyncTask | Dict
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector1 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> vector2 = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid)
>>> # save as layer >>> task = await client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async network_trace(vector_uuid, from_id, direction, tolerance, output_layer_name=None)[source]
[async] Performs a recursive spatial network trace, traversing connected lines based on specified direction and tolerance
- Parameters:
vector_uuid (str) – UUID of the vector layer
from_id (int) – Starting feature ID for the trace
direction (NetworkTraceDirection) – Direction of trace: UP(upstream) or DOWN(downstream)
tolerance (float) – Tolerance for network connectivity
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.network_trace( ... vector_uuid=vector1.uuid, ... from_id=10, ... direction=NetworkTraceDirection.UP, ... tolerance=10)
>>> # save as layer >>> task = await client.vector_tool.network_trace( ... vector_uuid=vector1.uuid, ... from_id=10, ... direction=NetworkTraceDirection.UP, ... tolerance=10), ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async number_of_geoms(vector_uuid, output_layer_name=None)[source]
[async] Counts the number of geometry parts in each multi-part shape, adding this count as a new column
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.number_of_geoms(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.number_of_geoms(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async number_of_points(vector_uuid, output_layer_name=None)[source]
[async] Counts the number of vertices in each geometry, providing an attribute with this point count
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.number_of_points(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.number_of_points(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async point_stats_in_polygon(polygon_vector_uuid, point_vector_uuid, stats_column, output_layer_name=None)[source]
[async] Aggregates statistical data for points within each polygon, calculating sum, average, minimum, and maximum
- Parameters:
polygon_vector_uuid (str) – UUID of the polygon layer
point_vector_uuid (str) – UUID of the point layer
stats_column (str) – Column to calculate statistics on
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> polygon_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> point_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.point_stats_in_polygon( ... polygon_vector_uuid=polygon_vector.uuid, ... point_vector_uuid=point_vector.uuid, ... stats_column="field_name")
>>> # save as layer >>> task = await client.vector_tool.point_stats_in_polygon( ... polygon_vector_uuid=polygon_vector.uuid, ... point_vector_uuid=point_vector.uuid, ... stats_column="field_name"), ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async remove_holes(vector_uuid, output_layer_name=None)[source]
[async] Removes interior holes from polygon geometries, leaving only the outer boundary of each shape
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.remove_holes(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.remove_holes(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async reverse_line(vector_uuid, output_layer_name=None)[source]
[async] Reverses the direction of line geometries, swapping start and end points of each line
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.reverse_line(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.reverse_line(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async simplify(vector_uuid, tolerance, output_layer_name=None)[source]
[async] Simplifies geometries based on a tolerance value, reducing detail while preserving general shape
- Parameters:
vector_uuid (str) – UUID of the vector layer
tolerance (float) – Simplification tolerance
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.simplify( ... vector_uuid=vector.uuid ... tolerance=10)
>>> # save as layer >>> task = await client.vector_tool.simplify( ... vector_uuid=vector.uuid ... tolerance=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async snap_to_grid(vector_uuid, grid_size, output_layer_name=None)[source]
[async] Aligns geometries to a grid of a specified size, rounding coordinates to fall on the grid lines
- Parameters:
vector_uuid (str) – UUID of the vector layer
grid_size (float) – Size of the grid cells
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.snap_to_grid( ... vector_uuid=vector.uuid ... grid_size=10)
>>> # save as layer >>> task = await client.vector_tool.snap_to_grid( ... vector_uuid=vector.uuid ... grid_size=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async spatial_aggregation(vector_uuid, agg_function, output_layer_name=None)[source]
[async] Aggregates geometries by performing spatial functions like union or extent on all geometries in the layer
- Parameters:
vector_uuid (str) – UUID of the vector layer
agg_function (SpatialAggFunction) – Aggregation function: collect, union, extent, makeline
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geobox.vector_tool import SpatialAggFunction >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.spatial_aggregation( ... vector_uuid=vector.uuid ... agg_function=SpatialAggFunction.COLLECT)
>>> # save as layer >>> task = await client.vector_tool.spatial_aggregation( ... vector_uuid=vector.uuid ... agg_function=SpatialAggFunction.COLLECT, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async spatial_filter(vector_uuid, spatial_predicate, filter_vector_uuid, output_layer_name=None)[source]
[async] Filters features in a layer based on spatial relationships with a filter layer, such as intersects, contains, or within
- Parameters:
vector_uuid (str) – UUID of the vector layer
spatial_predicate (SpatialPredicate) – Spatial predicate: Intersect, Contain, Cross, Equal, Overlap, Touch, Within
filter_vector_uuid (str) – UUID of the filter layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geobox.vector_tool import SpatialAggFunction >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.spatial_filter( ... vector_uuid=vector.uuid ... spatial_predicate=SpatialPredicate.INTERSECT, ... filter_vector_uuid=filter_vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.spatial_filter( ... vector_uuid=vector.uuid ... spatial_predicate=SpatialPredicate.INTERSECT, ... filter_vector_uuid=filter_vector.uuid, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async spatial_group_by(vector_uuid, group_column_name, agg_function, output_layer_name=None)[source]
[async] Groups geometries by a specified column and aggregates them using spatial functions like union, collect, or extent
- Parameters:
vector_uuid (str) – UUID of the vector layer
group_column_name (str) – Column to group by
agg_function (SpatialAggFunction) – Spatial aggregation function: collect, union, extent, makeline
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> from geobox.vector_tool import GroupByAggFunction >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.spatial_group_by( ... vector_uuid=vector.uuid, ... group_column_name="field_1", ... agg_function=SpatialAggFunction.COLLECT)
>>> # save as layer >>> task = await client.vector_tool.spatial_group_by( ... vector_uuid=vector.uuid, ... group_column_name="field_1", ... agg_function=SpatialAggFunction.COLLECT, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async square_grid(vector_uuid, cell_size, output_layer_name=None)[source]
[async] Generates a square grid across the layer extent, counting how many geometries intersect each square cell
- Parameters:
vector_uuid (str) – UUID of the vector layer
cell_size (float) – Size of square grid cells
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.square_grid( ... vector_uuid=vector.uuid, ... cell_size=10)
>>> # save as layer >>> task = await client.vector_tool.square_grid( ... vector_uuid=vector.uuid, ... cell_size=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async voronoi_polygons(vector_uuid, output_layer_name=None)[source]
[async] Creates Voronoi polygons from input points, partitioning the space so each polygon surrounds a unique point
- Parameters:
vector_uuid (str) – UUID of the vector layer
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async within_distance(vector_uuid, filter_vector_uuid, dist, output_layer_name=None)[source]
[async] Filters geometries that are within a specified distance of a filter layer, useful for proximity analysis
- Parameters:
vector_uuid (str) – UUID of the vector layer
filter_vector_uuid (str) – UUID of the filter layer
dist (float) – Search distance
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678") >>> filter_vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.within_distance( ... vector_uuid=vector.uuid, ... filter_vector_uuid=filter_vector=filter_vector.uuid, ... dist=10)
>>> # save as layer >>> task = await client.vector_tool.within_distance( ... vector_uuid=vector.uuid, ... filter_vector_uuid=filter_vector=filter_vector.uuid, ... dist=10, ... output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async xy_coordinate(vector_uuid, srid=3857, output_layer_name=None)[source]
[async] Extracts the X and Y coordinates for each geometry in a layer, adding coord_x and coord_y columns
- Parameters:
vector_uuid (str) – UUID of the vector layer
srid (int, optional) – SRID for coordinate extraction. default: 3857
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> vector = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.xy_coordinate(vector_uuid=vector.uuid)
>>> # save as layer >>> task = await client.vector_tool.xy_coordinate(vector_uuid=vector.uuid, output_layer_name="output_layer") >>> await task.wait() >>> output_layer = await task.output_asset
- async table_to_vectorlayer(table_uuid, lon_field, lat_field, output_layer_name=None)[source]
[async] Converts a table to a vector layer by converting the lon and lat columns to a point geometry.
- Parameters:
table_uuid (str) – UUID of the vector layer
lon_field (str) – field name containing lon value
lat_field (str) – field name containing lat value
output_layer_name (str, optional) – Name for the output layer. name must be a valid identifier and without spacing.
- Returns:
If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.
- Return type:
Union[‘AsyncTask’, Dict]
Example
>>> from geobox.aio import AsyncGeoboxClient >>> async with AsyncGeoboxClient() as client: >>> table = await client.get_table(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution >>> result = await client.vector_tool.table_to_vectorlayer( ... table_uuid=table.uuid, ... lon_field="lon_field_name", ... lat_field="lat_field_name", ... )
>>> # save as layer >>> task = await client.vector_tool.table_to_vectorlayer( ... table_uuid=table.uuid, ... lon_field="lon_field_name", ... lat_field="lat_field_name", ... output_layer_name="output_layer", ... ) >>> task.wait() >>> output_layer = task.output_asset