BufferTransformer#

class BufferTransformer[source]#

Bases: VectorTransformer

Buffers geometries.

__init__(geom_type: str, class_bufs: dict[int, float | None] | None = None, default_buf: float | None = None)[source]#

Constructor.

Parameters
  • geom_type (str) – The geometry type to apply this transform to. E.g. “LineString”, “Point”, “Polygon”.

  • class_bufs (dict[int, float | None] | None) – Mapping from class IDs to buffer amounts (in pixels). If a class ID is not found in the mapping, the value specified by the default_buf field will be used. If the buffer value for a class is None, then no buffering will be applied to the geoms of that class. Defaults to {}.

  • default_buf (float | None) – Default buffer to apply to classes not in class_bufs. If None, no buffering will be applied to the geoms of those missing classes. Defaults to None.

Methods

__init__(geom_type[, class_bufs, default_buf])

Constructor.

transform(geojson[, crs_transformer])

Transform a GeoJSON mapping of vector data.

__init__(geom_type: str, class_bufs: dict[int, float | None] | None = None, default_buf: float | None = None)[source]#

Constructor.

Parameters
  • geom_type (str) – The geometry type to apply this transform to. E.g. “LineString”, “Point”, “Polygon”.

  • class_bufs (dict[int, float | None] | None) – Mapping from class IDs to buffer amounts (in pixels). If a class ID is not found in the mapping, the value specified by the default_buf field will be used. If the buffer value for a class is None, then no buffering will be applied to the geoms of that class. Defaults to {}.

  • default_buf (float | None) – Default buffer to apply to classes not in class_bufs. If None, no buffering will be applied to the geoms of those missing classes. Defaults to None.

transform(geojson: dict, crs_transformer: CRSTransformer | None = None) dict[source]#

Transform a GeoJSON mapping of vector data.

Parameters
  • geojson (dict) – A GeoJSON-like mapping of a FeatureCollection.

  • crs_transformer (CRSTransformer | None) –

Returns

Transformed GeoJSON.

Return type

dict