class wradlib.zonalstats.DataSource(data=None, srs=None, name='layer', source=0, **kwargs)

DataSource class for handling ogr/gdal vector data

DataSource handles creates in-memory (vector) ogr DataSource object with one layer for point or polygon geometries.

  • data (sequence of source points (shape Nx2) or polygons (shape NxMx2) or) – ESRI Shapefile filename containing source points/polygons
  • srs (object) – ogr.SpatialReferenceSystem SRS describing projection of given data


Writing shapefiles with the wrong locale settings can have impact on the type of the decimal. If problem arise use LC_NUMERIC=C in your environment.


See DataSource.

dump_raster(filename[, driver, attr, …]) Output layer to GDAL Rasterfile
dump_vector(filename[, driver, remove]) Output layer to OGR Vector File
get_attributes(attrs[, filt]) Read attributes
get_attrs_and_props([attrs, props, filt]) Read properties and attributes
get_data_by_att([attr, value]) Returns DataSource geometries filtered by given attribute/value
get_data_by_geom([geom]) Returns DataSource geometries filtered by given OGR geometry
get_data_by_idx(idx) Returns DataSource geometries as numpy ndarrays from given index
get_geom_properties(props[, filt]) Read properties
load_vector(filename[, source, driver]) Read Layer from OGR Vector File
set_attribute(name, values) Add/Set given Attribute with given values
data Returns DataSource geometries as numpy ndarrays
ds Returns DataSource