gws.gis.gdalx

GDAL wrapper.

Source code: gws.gis.gdalx

Package Contents

exception gws.gis.gdalx.Error

Bases: gws.Error

GWS error.

class gws.gis.gdalx.DriverInfo(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

index: int
name: str
longName: str
metaData: dict
gws.gis.gdalx.drivers() list[DriverInfo]

Enumerate GDAL drivers.

gws.gis.gdalx.open(path, mode, driver: str = '', as_raster: bool = False, as_vector: bool = False, **opts) DataSet

Open a path and return a vector DataSet object.

Parameters:
  • path – File path.

  • mode – ‘r’ (read), ‘a’ (update), ‘w’ (create for writing)

  • driver – Driver name, if omitted, will be suggested from the path extension.

  • type – ‘raster’ or ‘vector’ for dual drivers, like Geopackage.

  • opts – Options for gdal.OpenEx/CreateDataSource.

Returns:

DataSet object.

gws.gis.gdalx.open_image(image: gws.Image, bounds: gws.Bounds) DataSet
gws.gis.gdalx.create_copy(path: str, ds: DataSet, driver: str = '', strict=False, **opts) DataSet
class gws.gis.gdalx.DataSet(path: str, gd: osgeo.gdal.Dataset)
gdDataset: osgeo.gdal.Dataset
gdDriver: osgeo.gdal.Driver
path: str
driverName: str
transaction()
close()
create_layer(name: str, columns: dict[str, gws.AttributeType], geometry_type: gws.GeometryType = None, crs: gws.Crs = None, overwrite=False, *options) Layer
layers()
layer(name) Layer | None
describe_layer(name) gws.DataSetDescription | None
class gws.gis.gdalx.Layer(gd_layer)
name: str
gdLayer: osgeo.ogr.Layer
gdLayerDefn: osgeo.ogr.FeatureDefn
describe() gws.DataSetDescription
insert(fds: list[gws.FeatureRecord], encoding: str = None) list[int]
count(force=False)
get_all(default_srid: int = 0, encoding: str = None) list[gws.FeatureRecord]
get_one(fid: int, default_srid: int = 0, encoding: str = None) gws.FeatureRecord | None