VectorSource#
- class VectorSource[source]#
Bases:
ABCA source of vector data.
Attributes
- __init__(crs_transformer: CRSTransformer, vector_transformers: list['VectorTransformer'] = [], bbox: rastervision.core.box.Box | None = None)[source]#
Constructor.
- Parameters:
crs_transformer (CRSTransformer) – A
CRSTransformerto convert between map and pixel coords. Normally this is obtained from aRasterSource.vector_transformers (list[VectorTransformer]) –
VectorTransformersfor transforming geometries. Defaults to[].bbox (Box | None) – User-specified crop of the extent. If None, the full extent available in the source file is used.
Methods
__init__(crs_transformer[, ...])Constructor.
get_dataframe([window, to_map_coords])Return geometries as a
GeoDataFrame.get_geojson([window, to_map_coords])Return transformed GeoJSON.
get_geoms([window, to_map_coords])Returns all geometries in the transformed GeoJSON as Shapely geoms.
- __init__(crs_transformer: CRSTransformer, vector_transformers: list['VectorTransformer'] = [], bbox: rastervision.core.box.Box | None = None)[source]#
Constructor.
- Parameters:
crs_transformer (CRSTransformer) – A
CRSTransformerto convert between map and pixel coords. Normally this is obtained from aRasterSource.vector_transformers (list[VectorTransformer]) –
VectorTransformersfor transforming geometries. Defaults to[].bbox (Box | None) – User-specified crop of the extent. If None, the full extent available in the source file is used.
- get_dataframe(window: rastervision.core.box.Box | None = None, to_map_coords: bool = False) GeoDataFrame[source]#
Return geometries as a
GeoDataFrame.- Parameters:
- Return type:
- get_geojson(window: rastervision.core.box.Box | None = None, to_map_coords: bool = False) dict[source]#
Return transformed GeoJSON.
This makes the following transformations to the raw geojson:
converts to pixels coords (by default)
removes empty features
splits apart multi-geoms and geom collections into single geometries
buffers lines and points into Polygons
Additionally, the transformations specified by all the VectorTransformers in vector_transformers are also applied.
- get_geoms(window: rastervision.core.box.Box | None = None, to_map_coords: bool = False) list['BaseGeometry'][source]#
Returns all geometries in the transformed GeoJSON as Shapely geoms.
- Parameters:
to_map_coords (bool) – If true, will return geoms in map coordinates.
window (rastervision.core.box.Box | None) –
- Returns:
List of Shapely geoms.
- Return type:
list[‘BaseGeometry’]