sentinelhub.geopedia.core

The core module for Geopedia interactions

class sentinelhub.geopedia.core.GeopediaService(config=None)[source]

Bases: object

The class for Geopedia OGC services

Parameters:

config (SHConfig | None) – A custom instance of config class to override parameters from the saved configuration.

class sentinelhub.geopedia.core.GeopediaSession(*, username=None, password=None, password_md5=None, is_global=False, **kwargs)[source]

Bases: GeopediaService

For retrieving data from Geopedia vector and raster layers it is required to make a session. This class handles starting and renewing of session and login (optional). It provides session headers required by Geopedia REST requests. Session duration is hardcoded to 1 hour with class attribute SESSION_DURATION. After that this class will automatically renew the session and login.

Parameters:
  • username (str | None) – Optional parameter in case of login with Geopedia credentials

  • password (str | None) – Optional parameter in case of login with Geopedia credentials

  • password_md5 (str | None) – Password can optionally also be provided as already encoded md5 hexadecimal string

  • is_global (bool) – If True this session will be shared among all instances of this class, otherwise it will be used only with the single instance. Default is False.

  • config – A custom instance of config class to override parameters from the saved configuration.

  • kwargs (Any) –

SESSION_DURATION = datetime.timedelta(seconds=3600)
UNAUTHENTICATED_USER_ID = 'NO_USER'
property session_info: dict

All information that Geopedia provides about the current session

Returns:

A dictionary with session info

property session_id: str

A public property of this class which provides a Geopedia session ID

Returns:

A session ID string

property session_headers: dict

Headers which have to be used when accessing any data from Geopedia with this session

Returns:

A dictionary containing session headers

property user_info: dict

Information that this session has about user

Returns:

A dictionary with user info

property user_id: str

Geopedia user ID. If no login was done during session this will return ‘NO_USER’.

Returns:

User ID string

restart()[source]

Method that restarts Geopedia Session

Returns:

It returns the object itself, with new session

Return type:

GeopediaSession

provide_session(start_new=False)[source]

Makes sure that session is still valid and provides session info

Parameters:

start_new (bool) – If True it will always create a new session. Otherwise, it will create a new session only if no session exists or the previous session timed out.

Returns:

Current session info

Return type:

dict

class sentinelhub.geopedia.core.GeopediaWmsService(**kwargs)[source]

Bases: GeopediaService, OgcImageService

Geopedia OGC services class for providing image data. Most of the methods are inherited from sentinelhub.ogc.OgcImageService class.

Parameters:
  • config – A custom instance of config class to override parameters from the saved configuration.

  • kwargs (Any) –

get_request(request)[source]

Get a list of DownloadRequests for all data that are under the given field in the table of a Geopedia layer.

Returns:

list of items which have to be downloaded

Parameters:

request (OgcRequest) –

Return type:

list[sentinelhub.download.models.DownloadRequest]

get_dates(_)[source]

Geopedia does not support date queries

Parameters:
Returns:

Undefined date

Return type:

list[datetime.datetime | None]

get_wfs_iterator()[source]

This method is inherited from OgcImageService but is not implemented.

Return type:

Any

class sentinelhub.geopedia.core.GeopediaImageService(**kwargs)[source]

Bases: GeopediaService

Service class that provides images from a Geopedia vector layer.

Parameters:
  • base_url – Base url of Geopedia REST services. If None, the url specified in the configuration file is taken.

  • kwargs (Any) –

get_request(request)[source]

Get a list of DownloadRequests for all data that are under the given field in the table of a Geopedia layer.

Returns:

list of items which have to be downloaded

Parameters:

request (GeopediaImageRequest) –

Return type:

list[DownloadRequest]

get_gpd_iterator()[source]

Returns iterator over info about data used for the GeopediaVectorRequest

Returns:

Iterator of dictionaries containing info about data used in the request.

Return type:

GeopediaFeatureIterator | None

class sentinelhub.geopedia.core.GeopediaFeatureIterator(layer, bbox=None, query_filter=None, offset=0, gpd_session=None, config=None)[source]

Bases: FeatureIterator[Dict[str, Any]]

Iterator for Geopedia Vector Service

Parameters:
  • layer (str | int) – Geopedia layer which contains requested data

  • bbox (BBox | None) – Bounding box of the requested image. Its coordinates must be in the CRS.POP_WEB (EPSG:3857) coordinate system.

  • query_filter (str | None) – Query string used for filtering returned features.

  • offset (int) – Offset of resulting features

  • gpd_session (GeopediaSession | None) – Optional parameter for specifying a custom Geopedia session, which can also contain login credentials. This can be used for accessing private Geopedia layers. By default, it is set to None and a basic Geopedia session without credentials will be created.

  • config (SHConfig | None) – A custom instance of config class to override parameters from the saved configuration.

FILTER_EXPRESSION = 'filterExpression'
MAX_FEATURES_PER_REQUEST = 1000
get_geometry_iterator()[source]

Iterator over Geopedia feature geometries

Return type:

Iterator[BaseGeometry]

get_field_iterator(field)[source]

Iterator over the specified field of Geopedia features

Parameters:

field (str) –

Return type:

Iterator[Any]

get_size()[source]

Provides number of features which can be obtained. It has to fetch at least one feature from Geopedia services to get this information.

Returns:

Size of Geopedia layer with applied filters

Return type:

int