raster_tools.Vector#

class raster_tools.Vector(geo, size=None)[source]#

A class representing vector data.

Take care to provide the actual number of features in the data when creating a new Vector.

__init__(geo, size=None)[source]#

Create a Vector object.

Parameters
  • geo (GeoDataFrame or GeoSeries) – The vector data to use. This can be a geopandas or dask_geopandas object.

  • size (int, optional) – The number of features. If not provided, A best effort will be made to determine the number of features. Part of the data may be temporarily loaded.

Methods

__init__(geo[, size])

Create a Vector object.

add_objectid_column([name])

Add a column of unique ID values to the set of features.

buffer(*args, **kwargs)

Apply the buffer operation to the vector geometries.

calculate_spatial_partitions([show_progress])

Calculate the spatial bounds of the underlying data.

cast_field(name, dtype)

Cast a field to the specified dtype.

copy()

Copies the vector.

eval()

Computes the built-up chain of operations on the underlying data.

load()

Compute delayed operations and load the result into memory.

model_predict(model, fields[, n_outputs, ...])

Predict new columns using a model.

save(path, **fiona_kwargs)

Save the vector data to a file.

simplify(*args, **kwargs)

Simplify the vector geometries.

spatial_shuffle([show_progress])

Shuffle the features into spatially grouped partitions.

to_crs(crs)

Transform the vector coordinates to the specified crs.

to_dask()

Returns the underlying data as a dask_geopandas.GeoDataFrame.

to_dataframe()

Returns the underlying GeoDataFrame.

to_lazy([npartitions])

Converts to a lazy dask-backed Vector.

to_raster(like[, field, ...])

Convert vector feature data to a raster.

to_shapely()

Returns the vector data as a list of shapely geometries objects.

Attributes

bounds

(minx, miny, maxx, maxy).

crs

The vector CRS.

data

field_dtypes

The field dtypes.

field_names

The field names.

field_schema

A mapping of the field names to dtypes.

geometry

The vector geometry series.

shape

The shape of the attribute table.

size

The number of vectors contained.

table

The vector attribute table.

tasks

The number of lazy operations left to be computed.