Class: QgsStacController

The QgsStacController class handles STAC requests.

Contains methods to generate STAC objects from local and remote urls.

Added in version 3.44.

Class Hierarchy

Inheritance diagram of qgis.core.QgsStacController

Base classes

QObject

Methods

authCfg

Returns the authentication config id which will be used during the request.

cancelPendingAsyncRequests

Cancels all pending async requests

fetchCollections

Fetches collections from url using a blocking network request.

fetchCollectionsAsync

Initiates an asynchronous request for a Collections collection using the url and returns an associated request id.

fetchItemCollection

Fetches a feature collection from url using a blocking network request.

fetchItemCollectionAsync

Initiates an asynchronous request for a feature collection using the url and returns an associated request id.

fetchStacObjectAsync

Initiates an asynchronous request for a STAC object using the url and returns an associated request id.

openLocalCatalog

Returns a STAC Catalog by parsing a local file The caller takes ownership of the returned catalog

openLocalCollection

Returns a STAC Collection by parsing a local file The caller takes ownership of the returned collection

openLocalItem

Returns a STAC Item by parsing a local file The caller takes ownership of the returned item

setAuthCfg

Sets the authentication config id which should be used during the request.

takeCollections

Returns the collections collection fetched with the specified requestId It should be used after the finishedCollectionsRequest signal is fired to get the fetched STAC collections.

takeItemCollection

Returns the feature collection fetched with the specified requestId It should be used after the finishedItemCollectionRequest signal is fired to get the fetched STAC item collection.

Signals

finishedCollectionsRequest

This signal is fired when an async request initiated with fetchCollectionsAsync is finished.

finishedItemCollectionRequest

This signal is fired when an async request initiated with fetchItemCollectionAsync is finished.

finishedStacObjectRequest

This signal is fired when an async request initiated with fetchStacObjectAsync is finished.

class qgis.core.QgsStacController[source]

Bases: QObject

__init__()

Default constructor

authCfg(self) str[source]

Returns the authentication config id which will be used during the request.

See also

setAuthCfg()

Return type:

str

cancelPendingAsyncRequests(self)[source]

Cancels all pending async requests

Added in version 3.42.

fetchCollections(self, url: QUrl, error: str | None | None = '') QgsStacCollectionList | None

Fetches collections from url using a blocking network request. An optional error parameter will be populated with any network error information. The caller takes ownership of the returned feature collection

Parameters:
  • url (QUrl)

  • error (Optional[Optional[str]] = '')

Return type:

Optional[QgsStacCollectionList]

fetchCollectionsAsync(self, url: QUrl) int[source]

Initiates an asynchronous request for a Collections collection using the url and returns an associated request id. When the request is completed, the finishedCollectionsRequest() signal is fired and the collections can be accessed with takeCollections()

Added in version 3.42.

Parameters:

url (QUrl)

Return type:

int

fetchItemCollection(self, url: QUrl, error: str | None | None = '') QgsStacItemCollection | None

Fetches a feature collection from url using a blocking network request. An optional error parameter will be populated with any network error information. The caller takes ownership of the returned feature collection

Parameters:
  • url (QUrl)

  • error (Optional[Optional[str]] = '')

Return type:

Optional[QgsStacItemCollection]

fetchItemCollectionAsync(self, url: QUrl) int[source]

Initiates an asynchronous request for a feature collection using the url and returns an associated request id. When the request is completed, the finishedItemCollectionRequest() signal is fired and the feature collection can be accessed with takeItemCollection()

Parameters:

url (QUrl)

Return type:

int

fetchStacObjectAsync(self, url: QUrl) int[source]

Initiates an asynchronous request for a STAC object using the url and returns an associated request id. When the request is completed, the finishedStacObjectRequest() signal is fired and the stac object can be accessed with takeStacObject()

Parameters:

url (QUrl)

Return type:

int

signal finishedCollectionsRequest(id: int, errorMessage: str)[source]

This signal is fired when an async request initiated with fetchCollectionsAsync is finished. The parsed STAC collections collection can be retrieved using takeCollections

Parameters:
  • id (int) – The requestId attribute of the finished request

  • errorMessage (str) – Reason the request or parsing of the STAC collections may have failed

Added in version 3.42.

signal finishedItemCollectionRequest(id: int, errorMessage: str)[source]

This signal is fired when an async request initiated with fetchItemCollectionAsync is finished. The parsed STAC item collection can be retrieved using takeItemCollection

Parameters:
  • id (int) – The requestId attribute of the finished request

  • errorMessage (str) – Reason the request or parsing of the STAC item collection may have failed

signal finishedStacObjectRequest(id: int, errorMessage: str)[source]

This signal is fired when an async request initiated with fetchStacObjectAsync is finished. The parsed STAC object can be retrieved using takeStacObject

Parameters:
  • id (int) – The requestId attribute of the finished request

  • errorMessage (str) – Reason the request or parsing of the STAC object may have failed

See also

takeStacObject()

openLocalCatalog(self, fileName: str | None) QgsStacCatalog | None

Returns a STAC Catalog by parsing a local file The caller takes ownership of the returned catalog

Parameters:

fileName (Optional[str])

Return type:

Optional[QgsStacCatalog]

openLocalCollection(self, fileName: str | None) QgsStacCollection | None

Returns a STAC Collection by parsing a local file The caller takes ownership of the returned collection

Parameters:

fileName (Optional[str])

Return type:

Optional[QgsStacCollection]

openLocalItem(self, fileName: str | None) QgsStacItem | None

Returns a STAC Item by parsing a local file The caller takes ownership of the returned item

Parameters:

fileName (Optional[str])

Return type:

Optional[QgsStacItem]

setAuthCfg(self, authCfg: str | None)[source]

Sets the authentication config id which should be used during the request.

See also

authCfg()

Parameters:

authCfg (Optional[str])

takeCollections(self, requestId: int) QgsStacCollectionList | None

Returns the collections collection fetched with the specified requestId It should be used after the finishedCollectionsRequest signal is fired to get the fetched STAC collections. Returns None if the requestId was not found, request was canceled, request failed or parsing the STAC object failed. The caller takes ownership of the returned collections

Added in version 3.42.

Parameters:

requestId (int)

Return type:

Optional[QgsStacCollectionList]

takeItemCollection(self, requestId: int) QgsStacItemCollection | None

Returns the feature collection fetched with the specified requestId It should be used after the finishedItemCollectionRequest signal is fired to get the fetched STAC item collection. Returns None if the requestId was not found, request was canceled, request failed or parsing the STAC object failed. The caller takes ownership of the returned feature collection

Parameters:

requestId (int)

Return type:

Optional[QgsStacItemCollection]