geopedia

Module for working with Geopedia

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

Bases: object

The class for Geopedia OGC services

Parameters:base_url (str or None) – Base url of Geopedia REST services. If None, the url specified in the configuration file is taken.
class sentinelhub.geopedia.GeopediaSession(*, username=None, password=None, password_md5=None, is_global=False, **kwargs)[source]

Bases: sentinelhub.geopedia.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 or None) – Optional parameter in case of login with Geopedia credentials
  • password (str or None) – Optional parameter in case of login with Geopedia credentials
  • password_md5 (str or 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.
  • base_url (str or None) – Base url of Geopedia REST services. If None, the url specified in the configuration file is taken.
session_info

All information that Geopedia provides about the current session

Returns:A dictionary with session info
Return type:dict
session_id

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

Returns:A session ID string
Return type:str
session_headers

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

Returns:A dictionary containing session headers
Return type:dict
user_info

Information that this session has about user

Returns:A dictionary with user info
Return type:dict
user_id

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

Returns:User ID string
Return type:str
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.GeopediaWmsService(base_url=None)[source]

Bases: sentinelhub.geopedia.GeopediaService, sentinelhub.ogc.OgcImageService

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

Parameters:base_url (str or None) – Base url of Geopedia WMS services. If None, the url specified in the configuration file is taken.
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
Return type:list(DownloadRequest)
get_dates(request)[source]

Geopedia does not support date queries

Parameters:request (WmsRequest or WcsRequest) – OGC-type request
Returns:Undefined date
Return type:[None]
get_wfs_iterator()[source]

This method is inherited from OgcImageService but is not implemented.

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

Bases: sentinelhub.geopedia.GeopediaService

Service class that provides images from a Geopedia vector layer.

Parameters:base_url (str or None) – Base url of Geopedia REST services. If None, the url specified in the configuration file is taken.
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
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:Iterator[dict] or None
class sentinelhub.geopedia.GeopediaFeatureIterator(layer, bbox=None, query_filter=None, gpd_session=None, **kwargs)[source]

Bases: sentinelhub.geopedia.GeopediaService

Iterator for Geopedia Vector Service

Parameters:
  • layer (str) – Geopedia layer which contains requested data
  • bbox (BBox) – Bounding box of the requested image. Its coordinates must be in the CRS.POP_WEB (EPSG:3857) coordinate system.
  • query_filter (str) – Query string used for filtering returned features.
  • gpd_session (GeopediaSession or 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.
  • base_url (str or None) – Base url of Geopedia REST services. If None, the url specified in the configuration file is taken.
get_geometry_iterator()[source]

Iterator over Geopedia feature geometries

get_field_iterator(field)[source]

Iterator over the specified field of Geopedia features

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