Vector Tool

The VectorTool module provides functionality for working with 50 vector processing tools.

class VectorTool(api)[source]

Bases: Base

Parameters:

api (GeoboxClient)

BASE_ENDPOINT = 'queries/'
__init__(api)[source]

Initialize a VectorTool instance.

Parameters:

api (GeoboxClient) – The GeoboxClient instance for making requests.

_add_params_to_query(query_name, inputs)[source]

add user input params to the query

Parameters:
  • query_name (str)

  • inputs (dict)

Return type:

Query

_run_query(query, output_layer_name=None)[source]

execute or save as layer

Parameters:
  • query (Query)

  • output_layer_name (str | None)

Return type:

Task | Dict

area(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.area(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.area(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
as_geojson(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.as_geojson(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.as_geojson(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
as_wkt(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.as_wkt(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.as_wkt(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
buffer(vector_uuid, distance, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000)
>>> # save as layer
>>> task = client.vector_tool.buffer(vector_uuid=vector.uuid, distance=1000, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
centroid(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.centroid(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.centroid(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
clip(vector_uuid, clip_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> clip_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.clip(vector_uuid=vector.uuid, clip_vector_uuid=clip_vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
concave_hull(vector_uuid, tolerance, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10)
>>> # save as layer
>>> task = client.vector_tool.concave_hull(vector_uuid=vector.uuid, tolerance=10, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
convex_hull(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.convex_hull(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.convex_hull(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
feature_count(vector_uuid)[source]

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 import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.feature_count(vector_uuid=vector.uuid)
count_point_in_polygons(polygon_vector_uuid, point_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> polygon_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> point_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.count_point_in_polygons(
...     polygon_vector_uuid=polygon_vector.uuid,
...     point_vector_uuid=point_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.count_point_in_polygons(
...     polygon_vector_uuid=polygon_vector.uuid,
...     point_vector_uuid=point_vector.uuid,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
delaunay_triangulation(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.delaunay_triangulation(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
disjoint(vector_uuid, filter_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> filter_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.disjoint(vector_uuid=vector.uuid, filter_vector_uuid=filter_vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
dissolve(vector_uuid, dissolve_field_name, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name")
>>> # save as layer
>>> task = client.vector_tool.dissolve(vector_uuid=vector.uuid, dissolve_field_name="field_name", output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
distance_to_nearest(vector_uuid, nearest_vector_uuid, search_radius, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> nearest_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.distance_to_nearest(
...     vector_uuid=vector.uuid,
...     nearest_vector_uuid=nearest_vector.uuid,
...     search_radius=10)
>>> # save as layer
>>> task = client.vector_tool.distance_to_nearest(
...     vector_uuid=vector.uuid,
...     nearest_vector_uuid=nearest_vector.uuid,
...     search_radius=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
distinct(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.distinct(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.distinct(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
dump(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.dump(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.dump(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
erase(vector_uuid, erase_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> erase_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.erase(vector_uuid=vector.uuid, erase_vector_uuid=erase_vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
feature_bbox(vector_uuid, srid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326)
>>> # save as layer
>>> task = client.vector_tool.feature_bbox(vector_uuid=vector.uuid, srid=4326, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
feature_extent(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.feature_extent(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.feature_extent(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
find_and_replace(vector_uuid, find, replace, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example")
>>> # save as layer
>>> task = client.vector_tool.find_and_replace(vector_uuid=vector.uuid, find="find example", replace="replce example", output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
from_geojson(vector_uuid, json_field_name, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field")
>>> # save as layer
>>> task = client.vector_tool.from_geojson(vector_uuid=vector.uuid, json_field_name="json_field", output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
from_wkt(vector_uuid, wkt_column_name, srid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field")
>>> # save as layer
>>> task = client.vector_tool.from_wkt(vector_uuid=vector.uuid, wkt_column_name="wkt_field", output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
generate_points(vector_uuid, number_of_points, seed, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10)
>>> # save as layer
>>> task = client.vector_tool.generate_points(vector_uuid=vector.uuid, number_of_points=10, seed=10, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
group_by(vector_uuid, group_column_name, agg_column_name, agg_function, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> from geobox.vector_tool import GroupByAggFunction
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = 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 = 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")
>>> task.wait()
>>> output_layer = task.output_asset
hexagon_grid(vector_uuid, cell_size, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.hexagon_grid(
...     vector_uuid=vector.uuid,
...     cell_size=10)
>>> # save as layer
>>> task = client.vector_tool.hexagon_grid(
...     vector_uuid=vector.uuid,
...     cell_size=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
intersection(vector_uuid, intersect_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> intersect_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.hexagon_grid(
...     vector_uuid=vector.uuid,
...     intersect_vector_uuid=intersect_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.hexagon_grid(
...     vector_uuid=vector.uuid,
...     intersect_vector_uuid=intersect_vector.uuid,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
join(vector1_uuid, vector2_uuid, vector1_join_column, vector2_join_column, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector1 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> vector2 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = 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 = 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")
>>> task.wait()
>>> output_layer = task.output_asset
lat_lon_to_point(latitude, longitude, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> # execution
>>> result = client.vector_tool.lat_lon_to_point(
...     latitude=10,
...     longitude=10)
>>> # save as layer
>>> task = client.vector_tool.lat_lon_to_point(
...     latitude=10,
...     longitude=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
layer_bbox(vector_uuid, srid)[source]

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 import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.layer_bbox(vector_uuid=vector.uuid, srid=4326)
layer_extent(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.layer_extent(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.layer_extent(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
length(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.length(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.length(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
linear_referencing(vector_uuid, feature_id, dist, tolerance, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> feature = vector.get_features()
>>> # execution
>>> result = client.vector_tool.linear_referencing(
...     vector_uuid=vector.uuid,
...     feature_id=feature.id,
...     dist=10,
...     tolerance=10)
>>> # save as layer
>>> task = client.vector_tool.linear_referencing(
...     vector_uuid=vector.uuid,
...     feature_id=feature.id,
...     dist=10,
...     tolerance=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
line_to_polygon(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.line_to_polygon(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.line_to_polygon(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
make_envelop(xmin, ymin, xmax, ymax, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10)
>>> # save as layer
>>> task = client.vector_tool.make_envelop(xmin=10. ymin=10, xmax=10, ymax=10, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
merge(vector1_uuid, vector2_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]: If output_layer_name is specified, the function returns a task object; if not, it returns the vector tool execution result.

Return type:

Task | Dict

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector1 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> vector2 = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid)
>>> # save as layer
>>> task = client.vector_tool.merge(vector1_uuid=vector1.uuid, vector2_uuid=vector2.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
network_trace(vector_uuid, from_id, direction, tolerance, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.network_trace(
...     vector_uuid=vector1.uuid,
...     from_id=10,
...     direction=NetworkTraceDirection.UP,
...     tolerance=10)
>>> # save as layer
>>> task = client.vector_tool.network_trace(
...     vector_uuid=vector1.uuid,
...     from_id=10,
...     direction=NetworkTraceDirection.UP,
...     tolerance=10),
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
number_of_geoms(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.number_of_geoms(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.number_of_geoms(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
number_of_points(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.number_of_points(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.number_of_points(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
point_stats_in_polygon(polygon_vector_uuid, point_vector_uuid, stats_column, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> polygon_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> point_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = 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 = 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")
>>> task.wait()
>>> output_layer = task.output_asset
remove_holes(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.remove_holes(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.remove_holes(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
reverse_line(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.reverse_line(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.reverse_line(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
simplify(vector_uuid, tolerance, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.simplify(
...     vector_uuid=vector.uuid
...     tolerance=10)
>>> # save as layer
>>> task = client.vector_tool.simplify(
...     vector_uuid=vector.uuid
...     tolerance=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
snap_to_grid(vector_uuid, grid_size, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.snap_to_grid(
...     vector_uuid=vector.uuid
...     grid_size=10)
>>> # save as layer
>>> task = client.vector_tool.snap_to_grid(
...     vector_uuid=vector.uuid
...     grid_size=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
spatial_aggregation(vector_uuid, agg_function, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> from geobox.vector_tool import SpatialAggFunction
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.spatial_aggregation(
...     vector_uuid=vector.uuid
...     agg_function=SpatialAggFunction.COLLECT)
>>> # save as layer
>>> task = client.vector_tool.spatial_aggregation(
...     vector_uuid=vector.uuid
...     agg_function=SpatialAggFunction.COLLECT,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
spatial_filter(vector_uuid, spatial_predicate, filter_vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> from geobox.vector_tool import SpatialAggFunction
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> filter_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.spatial_filter(
...     vector_uuid=vector.uuid
...     spatial_predicate=SpatialPredicate.INTERSECT,
...     filter_vector_uuid=filter_vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.spatial_filter(
...     vector_uuid=vector.uuid
...     spatial_predicate=SpatialPredicate.INTERSECT,
...     filter_vector_uuid=filter_vector.uuid,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
spatial_group_by(vector_uuid, group_column_name, agg_function, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> from geobox.vector_tool import GroupByAggFunction
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.spatial_group_by(
...     vector_uuid=vector.uuid,
...     group_column_name="field_1",
...     agg_function=SpatialAggFunction.COLLECT)
>>> # save as layer
>>> task = client.vector_tool.spatial_group_by(
...     vector_uuid=vector.uuid,
...     group_column_name="field_1",
...     agg_function=SpatialAggFunction.COLLECT,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
square_grid(vector_uuid, cell_size, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.square_grid(
...     vector_uuid=vector.uuid,
...     cell_size=10)
>>> # save as layer
>>> task = client.vector_tool.square_grid(
...     vector_uuid=vector.uuid,
...     cell_size=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
voronoi_polygons(vector_uuid, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.voronoi_polygons(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
within_distance(vector_uuid, filter_vector_uuid, dist, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> filter_vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.within_distance(
...     vector_uuid=vector.uuid,
...     filter_vector_uuid=filter_vector=filter_vector.uuid,
...     dist=10)
>>> # save as layer
>>> task = client.vector_tool.within_distance(
...     vector_uuid=vector.uuid,
...     filter_vector_uuid=filter_vector=filter_vector.uuid,
...     dist=10,
...     output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
xy_coordinate(vector_uuid, srid=3857, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> vector = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.xy_coordinate(vector_uuid=vector.uuid)
>>> # save as layer
>>> task = client.vector_tool.xy_coordinate(vector_uuid=vector.uuid, output_layer_name="output_layer")
>>> task.wait()
>>> output_layer = task.output_asset
table_to_vectorlayer(table_uuid, lon_field, lat_field, output_layer_name=None)[source]

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[‘Task’, Dict]

Example

>>> from geobox import GeoboxClient
>>> client = GeoboxClient()
>>> table = client.get_table(uuid="12345678-1234-5678-1234-567812345678")
>>> # execution
>>> result = client.vector_tool.table_to_vectorlayer(
...     table_uuid=table.uuid,
...     lon_field="lon_field_name",
...     lat_field="lat_field_name",
... )
>>> # save as layer
>>> task = 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