wradlib.io.gdal.VectorSource#
- class wradlib.io.gdal.VectorSource(data=None, trg_crs=None, name='layer', source=0, **kwargs)[source]#
Bases:
object
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/polygonstrg_crs (
osgeo.osr.SpatialReference
) – GDAL OSR SRS describing target CRS the 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”.src_crs (
osgeo.osr.SpatialReference
) – GDAL OGR 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.
- property mode#
- property ds#
Returns VectorSource
- property extent#
- property crs#
- property data#
Returns VectorSource geometries as numpy arrays
Note
This may be slow, because it extracts all source polygons
- property geo#
Returns VectorSource geometries as GeoPandas Dataframe
- get_data_by_att(attr=None, value=None, mode=None)[source]#
Returns DataSource geometries filtered by given attribute/value
- get_data_by_geom(geom=None, mode=None)[source]#
Returns DataSource geometries filtered by given geometry
- Keyword Arguments:
geom (
osgeo.ogr.Geometry
|geopandas.GeoDataFrame
) – OGR.Geometry object or geopandas.GeoDataFrame containing the Geometrymode (
str
) – return type (“numpy”, “geo”, “ogr”), defaults to “numpy”
- dump_vector(filename, *, driver='ESRI Shapefile', remove=True)[source]#
Output layer to OGR Vector File
- load_vector(filename, *, source=0, driver='ESRI Shapefile')[source]#
Read Layer from OGR Vector File
- dump_raster(filename, *, driver='GTiff', attr=None, pixel_size=1.0, **kwargs)[source]#
Output layer to GDAL Rasterfile
- Parameters:
- Keyword Arguments:
- set_attribute(name, values, *, reset_filter=False)[source]#
Add/Set given Attribute with given values
- Parameters:
name (
str
) – Attribute Namevalues (
numpy.ndarray
) – Values to fill in attributes.reset_filter (
bool
, optional) – reset any layer filter (spatial/attribute), defaults to False.
|
|
|
Output layer to GDAL Rasterfile |
|
Output layer to OGR Vector File |
|
Return attributes |
|
Return properties and attributes |
|
Returns DataSource geometries filtered by given attribute/value |
|
Returns DataSource geometries filtered by given geometry |
|
Returns DataSource geometries from given index |
|
Return geometry properties |
|
Read Layer from OGR Vector File |
|
Add/Set given Attribute with given values |
Returns VectorSource geometries as numpy arrays |
|
Returns VectorSource |
|
Returns VectorSource geometries as GeoPandas Dataframe |
|