eolearn.io.geometry_io

Module for adding vector data from various sources

class eolearn.io.geometry_io.VectorImportTask(*args, **kwargs)[source]

Bases: eolearn.io.geometry_io._BaseVectorImportTask

A task for importing (Fiona readable) vector data files into an EOPatch

Parameters
  • feature ((FeatureType, str)) – A vector feature into which to import data

  • path (str) – A path to a dataset containing vector data. It can be either a local path or a path to s3 bucket

  • reproject (bool, default = True) – Should the geometries be transformed to coordinate reference system of the requested bbox?

  • clip (bool, default = False) – Should the geometries be clipped to the requested bbox, or should be geometries kept as they are?

  • config (SHConfig) – A configuration object with AWS credentials (if not provided, ~/.aws/credentials will be used)

  • kwargs – Additional args that will be passed to fiona.open or geopandas.read calls (e.g. layer name)

property aws_session

Because the session object cannot be pickled this provides the session lazily (i.e. the first time it is needed)

Returns

A session for AWS services

Return type

AWSSession

property dataset_crs

Provides a CRS of dataset, it loads it lazily (i.e. the first time it is needed)

Returns

Dataset’s CRS

Return type

CRS

execute(eopatch=None, *, bbox=None)
Parameters
  • eopatch (EOPatch) – An existing EOPatch. If none is provided it will create a new one.

  • bbox – A bounding box for which to load data. By default, if none is provided, it will take a bounding box of given EOPatch. If given EOPatch is not provided it will load the entire dataset.

Returns

An EOPatch with an additional vector feature

Return type

EOPatch

execute_and_monitor(*eopatches, **kwargs)

In the current version nothing additional happens in this method

class eolearn.io.geometry_io.GeopediaVectorImportTask(*args, **kwargs)[source]

Bases: eolearn.io.geometry_io._BaseVectorImportTask

A task for importing Geopedia features into EOPatch vector features

Parameters
  • feature ((FeatureType, str)) – A vector feature into which to import data

  • geopedia_table (str or int) – A Geopedia table from which to retrieve features

  • reproject (bool, default = True) – Should the geometries be transformed to coordinate reference system of the requested bbox?

  • clip (bool, default = False) – Should the geometries be clipped to the requested bbox, or should be geometries kept as they are?

  • kwargs – Additional args that will be passed to GeopediaFeatureIterator

execute(eopatch=None, *, bbox=None)
Parameters
  • eopatch (EOPatch) – An existing EOPatch. If none is provided it will create a new one.

  • bbox – A bounding box for which to load data. By default, if none is provided, it will take a bounding box of given EOPatch. If given EOPatch is not provided it will load the entire dataset.

Returns

An EOPatch with an additional vector feature

Return type

EOPatch

execute_and_monitor(*eopatches, **kwargs)

In the current version nothing additional happens in this method

class eolearn.io.geometry_io.GeoDBVectorImportTask(*args, **kwargs)[source]

Bases: eolearn.io.geometry_io._BaseVectorImportTask

A task for importing vector data from geoDB into EOPatch

Parameters
  • feature ((FeatureType, str)) – A vector feature into which to import data

  • geodb_client (xcube_geodb.core.geodb.GeoDBClient) – an instance of GeoDBClient

  • geodb_collection (str) – The name of the collection to be queried

  • geodb_db (str) – The name of the database the collection resides in [current database]

  • reproject (bool, default = True) – Should the geometries be transformed to coordinate reference system of the requested bbox?

  • clip (bool, default = False) – Should the geometries be clipped to the requested bbox, or should be geometries kept as they are?

  • kwargs – Additional args that will be passed to geodb_client.get_collection_by_bbox call (e.g. where=”id>-1”, operator=”and”)

property dataset_crs

Provides a “crs” of dataset, loads it lazily (i.e. the first time it is needed)

Returns

Dataset’s CRS

Return type

CRS

execute(eopatch=None, *, bbox=None)
Parameters
  • eopatch (EOPatch) – An existing EOPatch. If none is provided it will create a new one.

  • bbox – A bounding box for which to load data. By default, if none is provided, it will take a bounding box of given EOPatch. If given EOPatch is not provided it will load the entire dataset.

Returns

An EOPatch with an additional vector feature

Return type

EOPatch

execute_and_monitor(*eopatches, **kwargs)

In the current version nothing additional happens in this method