Async Scene

This module provides functionality for working with async scenes.

class AsyncScene(api, uuid, data={})[source]

Bases: AsyncBase

Parameters:
BASE_ENDPOINT = 'scenes/'
__init__(api, uuid, data={})[source]

Initialize a Scene instance.

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

  • uuid (str) – The unique identifier for the Scene.

  • data (Dict) – The data of the Scene.

async classmethod get_scenes(api, **kwargs)[source]

[async] Get list of scenes with optional filtering and pagination.

Parameters:

api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

Keyword Arguments:
  • q (str) – query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01’”

  • search (str) – search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.

  • search_fields (str) – comma separated list of fields for searching.

  • order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: “A” denotes ascending order and “D” denotes descending order.

  • return_count (bool) – Whether to return total count. default is False.

  • skip (int) – Number of items to skip. default is 0.

  • limit (int) – Number of items to return. default is 10.

  • user_id (int) – Specific user. privileges required.

  • shared (bool) – Whether to return shared scenes. default is False.

Returns:

A list of scene instances or the total number of scenes.

Return type:

List[AsyncScene] | int

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scenes = await AsyncScene.get_scenes(client, q="name LIKE '%My scene%'")
or
>>>     scenes = await client.get_scenes(q="name LIKE '%My scene%'")
async classmethod create_scene(api, name, display_name=None, description=None, settings={}, thumbnail=None, user_id=None)[source]

[async] Create a new scene.

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

  • name (str) – The name of the scene.

  • display_name (str, optional) – The display name of the scene.

  • description (str, optional) – The description of the scene.

  • settings (Dict,optional) – The settings of the scene.

  • thumbnail (str, optional) – The thumbnail of the scene.

  • user_id (int, optional) – Specific user. privileges required.

Returns:

The newly created scene instance.

Return type:

AsyncScene

Raises:

ValidationError – If the scene data is invalid.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.create_scene(client, name="my_scene")
or
>>>     scene = await client.create_scene(name="my_scene")
async classmethod get_scene(api, uuid, user_id=None)[source]

[async] Get a scene by its UUID.

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

  • uuid (str) – The UUID of the scene to get.

  • user_id (int, optional) – Specific user. privileges required.

Returns:

The scene object.

Return type:

AsyncScene

Raises:

NotFoundError – If the scene with the specified UUID is not found.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
or
>>>     scene = await client.get_scene(uuid="12345678-1234-5678-1234-567812345678")
async classmethod get_scene_by_name(api, name, user_id=None)[source]

[async] Get a scene by name

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

  • name (str) – the name of the scene to get

  • user_id (int, optional) – specific user. privileges required.

Returns:

returns the scene if a scene matches the given name, else None

Return type:

AsyncScene | None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene_by_name(client, name='test')
or
>>>     scene = await client.get_scene_by_name(name='test')
async update(**kwargs)[source]

[async] Update the scene.

Keyword Arguments:
  • name (str) – The name of the scene.

  • display_name (str) – The display name of the scene.

  • description (str) – The description of the scene.

  • settings (Dict) – The settings of the scene.

  • thumbnail (str) – The thumbnail of the scene.

Returns:

The updated scene data.

Return type:

Dict

Raises:
  • ApiRequestError – If the API request fails.

  • ValidationError – If the scene data is invalid.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await scene.update(display_name="New Display Name")
async delete()[source]

[async] Delete the scene.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await scene.delete()
property thumbnail: str

Get the thumbnail URL of the scene.

Returns:

The thumbnail of the scene.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     scene.thumbnail
async share(users)[source]

[async] Shares the scene with specified users.

Parameters:

users (List[AsyncUser]) – The list of user objects to share the scene with.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await scene.share(users=users)
async unshare(users)[source]

[async] Unshares the scene with specified users.

Parameters:

users (List[AsyncUser]) – The list of user objects to unshare the scene with.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await scene.unshare(users=users)
async get_shared_users(search=None, skip=0, limit=10)[source]

[async] Retrieves the list of users the scene is shared with.

Parameters:
  • search (str, optional) – The search query.

  • skip (int, optional) – The number of users to skip.

  • limit (int, optional) – The maximum number of users to retrieve.

Returns:

The list of shared users.

Return type:

List[AsyncUser]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.scene import AsyncScene
>>> async with AsyncGeoboxClient() as client:
>>>     scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await scene.get_shared_users(search='John', skip=0, limit=10)