get_nodata_vector#

get_nodata_vector(dst: Union[str, tuple, rasterio.io.DatasetReader], default_nodata: int = 0) geopandas.geodataframe.GeoDataFrame[source]#

Get the nodata vector of a raster as a vector.

Pay attention that every nodata pixel will appear too. If you want only the footprint of the raster, please use get_footprint.

>>> raster_path = "path/to/raster.tif"  # Classified raster, with no data set to 255
>>> nodata1 = get_nodata_vec(raster_path)
>>> # or
>>> with rasterio.open(raster_path) as dst:
>>>     nodata2 = get_nodata_vec(dst)
>>> nodata1 == nodata2
True
Parameters
  • dst (PATH_ARR_DS) – Path to the raster, its dataset, its xarray or a tuple containing its array and metadata

  • default_nodata (int) – Default values for nodata in case of non existing in file

Returns

Nodata Vector

Return type

gpd.GeoDataFrame