Scene
This module provides functionality for working with scenes.
- class Scene(api, uuid, data={})[source]
Bases:
Base- Parameters:
api (GeoboxClient)
uuid (str)
data (Dict | None)
- BASE_ENDPOINT = 'scenes/'
- __init__(api, uuid, data={})[source]
Initialize a Scene instance.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
uuid (str) – The unique identifier for the Scene.
data (Dict) – The data of the Scene.
- classmethod get_scenes(api, **kwargs)[source]
Get list of scenes with optional filtering and pagination.
- Parameters:
api (GeoboxClient) – The GeoboxClient 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[Scene] | int
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scenes = Scene.get_scenes(client, q="name LIKE '%My scene%'") or >>> scenes = client.get_scenes(q="name LIKE '%My scene%'")
- classmethod create_scene(api, name, display_name=None, description=None, settings={}, thumbnail=None, user_id=None)[source]
Create a new scene.
- Parameters:
api (GeoboxClient) – The GeoboxClient 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:
- Raises:
ValidationError – If the scene data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.create_scene(client, name="my_scene") or >>> scene = client.create_scene(name="my_scene")
- classmethod get_scene(api, uuid, user_id=None)[source]
Get a scene by its UUID.
- Parameters:
api (GeoboxClient) – The GeoboxClient 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:
- Raises:
NotFoundError – If the scene with the specified UUID is not found.
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") or >>> scene = client.get_scene(uuid="12345678-1234-5678-1234-567812345678")
- classmethod get_scene_by_name(api, name, user_id=None)[source]
Get a scene by name
- Parameters:
api (GeoboxClient) – The GeoboxClient 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:
Scene | None
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene_by_name(client, name='test') or >>> scene = client.get_scene_by_name(name='test')
- update(**kwargs)[source]
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 import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> scene.update(display_name="New Display Name")
- delete()[source]
Delete the scene.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> scene.delete()
- property thumbnail: str
Get the thumbnail URL of the scene.
- Returns:
The thumbnail of the scene.
- Return type:
str
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> scene.thumbnail
Shares the scene with specified users.
- Parameters:
users (List[User]) – The list of user objects to share the scene with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> scene.share(users=users)
Unshares the scene with specified users.
- Parameters:
users (List[User]) – The list of user objects to unshare the scene with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> scene.unshare(users=users)
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[User]
Example
>>> from geobox import GeoboxClient >>> from geobox.scene import Scene >>> client = GeoboxClient() >>> scene = Scene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678") >>> scene.get_shared_users(search='John', skip=0, limit=10)