wradlib.io.gdal.VectorSource#

class wradlib.io.gdal.VectorSource(data=None, srs=None, name='layer', source=0, **kwargs)[source]#

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.

Parameters:
  • data (sequence or str) – sequence of source points (shape Nx2) or polygons (shape NxMx2) or Vector File (GDAL/OGR) filename containing source points/polygons

  • srs (osgeo.osr.SpatialReference) – SRS describing projection source data should be projected to

Keyword Arguments:
  • name (str) – Layer Name, defaults to “layer”.

  • source (int) – Number of layer to load, if multiple layers in source shape file.

  • mode (str) – Return type of class access functions/properties. Can be either of “numpy”, “geo” and “ogr”, defaults to “numpy”.

  • projection_source (osgeo.osr.SpatialReference) – SRS describing projection source in which data is provided in.

Warning

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.

Examples

See Vector Source.

__init__(data=None, srs=None, name='layer', source=0, **kwargs)[source]#

Methods

__init__([data, srs, name, source])

close()

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])

Return attributes

get_attrs_and_props([attrs, props, filt])

Return properties and attributes

get_data_by_att([attr, value, mode])

Returns DataSource geometries filtered by given attribute/value

get_data_by_geom([geom, mode])

Returns DataSource geometries filtered by given geometry

get_data_by_idx(idx[, mode])

Returns DataSource geometries from given index

get_geom_properties(props[, filt])

Return geometry properties

load_vector(filename[, source, driver])

Read Layer from OGR Vector File

set_attribute(name, values[, reset_filter])

Add/Set given Attribute with given values

Attributes

crs

data

Returns VectorSource geometries as numpy arrays

ds

Returns VectorSource

extent

geo

Returns VectorSource geometries as GeoPandas Dataframe

mode