raster_tools.Raster.to_vector#

Raster.to_vector(as_polygons=False, neighbors=4)[source]#

Convert the raster to a vector.

Parameters
  • as_polygons (bool, optional) – If True, the raster is converted to polygons/multi-polygon, each polyon/mult-polygon is made up of like-valued cells. Null cells are ignored. to_polygons() for more information. If False, the raster is converted to points. Each non-null cell is a point in the output. See to_points() for more information. Default is False.

  • neighbors ({4, 8} int, optional) – Used when as_polygons is True. This determines how many neighboring cells to consider when joining cells together to form polygons. Valid values are 4 and 8. 8 causes diagonal neighbors to be used. Default is 4.

Returns

A GeoDataFrame. If as_polygons is True, the result is a dataframe with columns: value, band, geometry. The geometry column will contain polygons. If False, the result has columns: value, band, row, col, geometry. The geometry column will contain points.

Return type

dask_geopandas.GeoDataFrame