Async Mosaic

The async Mosaic module provides functionality for working with mosaics.

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

Bases: AsyncRaster

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

Initialize a Mosaic instance.

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

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

  • data (Dict, optional) – The data of the mosaic.

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

[async] Get a list of mosaics.

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’”.

  • seacrh (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) – if true, the number of mosaics will be returned.

  • skip (int) – number of mosaics to skip. minimum value is 0.

  • limit (int) – maximum number of mosaics to return. minimum value is 1.

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

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

Returns:

A list of Mosaic instances or the number of mosaics.

Return type:

List[AsyncMosaic] | int

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaics = await AsyncMosaic.get_mosaics(client, q="name LIKE '%GIS%'")
or
>>>     mosaics = await client.get_mosaics(q="name LIKE '%GIS%'")
async classmethod get_mosaics_by_ids(api, ids, user_id=None)[source]

[async] Get mosaics by their IDs.

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

  • ids (List[str]) – The IDs of the mosaics.

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

Returns:

A list of Mosaic instances.

Return type:

List[AsyncMosaic]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaics = await AsyncMosaic.get_mosaics_by_ids(client, ids=['1, 2, 3'])
or
>>>     mosaics = await client.get_mosaics_by_ids(ids=['1, 2, 3'])
async classmethod create_mosaic(api, name, display_name=None, description=None, pixel_selection=None, min_zoom=None, user_id=None)[source]

[async] Create New Raster Mosaic

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

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

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

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

  • pixel_selection (str, optional) – The pixel selection of the mosaic.

  • min_zoom (int, optional) – The minimum zoom of the mosaic.

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

Returns:

The created mosaic.

Return type:

AsyncMosaic

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.create_mosaic(client, name='mosaic_name')
or
>>>     mosaic = await client.create_mosaic(name='mosaic_name')
async classmethod get_mosaic(api, uuid, user_id=None)[source]

[async] Get a mosaic by uuid.

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

  • uuid (str) – The UUID of the mosaic.

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

Returns:

The mosaic object.

Return type:

AsyncMosaic

Example

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

[async] Get a mosaic by name

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

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

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

Returns:

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

Return type:

AsyncMosaic | None

Example

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

[async] Update a mosaic.

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

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

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

  • pixel_selection (str) – The pixel selection of the mosaic.

  • min_zoom (int) – The minimum zoom of the mosaic.

Returns:

the updated data

Return type:

Dict

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.update(name='new_name', display_name='new_display_name', description='new_description', pixel_selection='new_pixel_selection', min_zoom=10)
async delete()[source]

[async] Delete the mosaic.

Returns:

None

Return type:

None

Example

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

Get the thumbnail of the mosaic.

Returns:

The thumbnail url of the mosaic.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     mosaic.thumbnail
async get_point(lat, lng)[source]

[async] Get the points of the mosaic.

Parameters:
  • lat (float) – The latitude of the point.

  • lng (float) – The longitude of the point.

Returns:

The points of the mosaic.

Return type:

List[float]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.get_point(lat=60, lng=50)
get_render_png_url(x='{x}', y='{y}', z='{z}', **kwargs)[source]

Get the tile render URL of the mosaic.

Parameters:
  • x (int, optional) – The x coordinate of the tile.

  • y (int, optional) – The y coordinate of the tile.

  • z (int, optional) – The zoom level of the tile.

Keyword Arguments:
  • indexes (str, optional) – list of comma separated band indexes to be rendered. e.g. 1, 2, 3

  • nodata (int, optional)

  • expression (str, optional) – band math expression. e.g. b1*b2+b3

  • rescale (List, optional) – comma (‘,’) separated Min,Max range. Can set multiple time for multiple bands.

  • color_formula (str, optional) – Color formula. e.g. gamma R 0.5

  • colormap_name (str, optional)

  • colormap (str, optional) – JSON encoded custom Colormap. e.g. {“0”: “#ff0000”, “1”: “#00ff00”} or [[[0, 100], “#ff0000”], [[100, 200], “#00ff00”]]

Returns:

The tile render URL of the mosaic.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     mosaic.get_tile_render_url(x=1, y=1, z=1)
get_tile_png_url(x='{x}', y='{y}', z='{z}')[source]

Get the tile PNG URL of the mosaic.

Parameters:
  • x (int, optional) – The x coordinate of the tile.

  • y (int, optional) – The y coordinate of the tile.

  • z (int, optional) – The zoom level of the tile.

Returns:

The tile PNG URL of the mosaic.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     mosaic.get_tile_png_url(x=1, y=1, z=1)
async get_tile_json()[source]

[async] Get the tile JSON of the raster.

Returns:

The tile JSON of the raster.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.get_tile_json()
wmts(scale=None)[source]

Get the WMTS URL

Parameters:

scale (int, optional) – The scale of the raster. values are: 1, 2

Returns:

The WMTS URL of the mosaic.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     mosaic.wmts(scale=1)
property settings: Dict

[async] Get the settings of the mosaic.

Returns:

The settings of the mosaic.

Return type:

Dict

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.settings
async update_settings(settings)[source]

[async] Update the settings

settings (Dict): settings dictionary

Returns:

updated settings

Return type:

Dict

Parameters:

settings (Dict)

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic1 = await client.get_mosaic(uuid="12345678-1234-5678-1234-567812345678")
>>>     mosaic2 = await client.get_mosaic(uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic1.update_settings(mosaic2.settings)
async set_settings(**kwargs)[source]

[async] Set the settings of the mosaic.

Keyword Arguments:
  • nodata (int) – The nodata value of the raster.

  • indexes (list[int]) – The indexes of the raster.

  • rescale (list[int]) – The rescale of the raster.

  • colormap_name (str) – The colormap name of the raster.

  • color_formula (str) – The color formula of the raster.

  • expression (str) – The expression of the raster.

  • exaggeraion (int) – The exaggeraion of the raster.

  • min_zoom (int) – The min zoom of the raster.

  • max_zoom (int) – The max zoom of the raster.

  • use_cache (bool) – Whether to use cache of the raster.

  • cache_until_zoom (int) – The cache until zoom of the raster.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.set_settings(nodata=0,
...                                 indexes=[1],
...                                 rescale=[[0, 10000]],
...                                 colormap_name='gist_rainbow',
...                                 color_formula='Gamma R 0.5',
...                                 expression='b1 * 2',
...                                 exaggeraion=10,
...                                 min_zoom=0,
...                                 max_zoom=22,
...                                 use_cache=True,
...                                 cache_until_zoom=17)
async get_rasters(user_id=None)[source]

[async] Get the rasters of the mosaic

Parameters:

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

Returns:

The rasters of the mosaic.

Return type:

List[AsyncRaster]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     rasters = await mosaic.get_rasters()
async add_rasters(rasters)[source]

[async] Add a raster to the mosaic.

Parameters:

rasters (List[Raster]) – list of raster objects to add

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     rasters = await client.get_rasters()
>>>     await mosaic.add_raster(rasters=rasters)
async remove_rasters(rasters)[source]

[async] Remove a raster from the mosaic.

Parameters:

rasters (List[AsyncRaster]) – list of raster objects to remove

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     rasters = await client.get_raster()
>>>     await mosaic.remove_rasters(rasters=rasters)
async share(users)[source]

[async] Shares the mosaic with specified users.

Parameters:

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

Returns:

None

Return type:

None

Example

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

[async] Unshares the mosaic with specified users.

Parameters:

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

Returns:

None

Return type:

None

Example

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

[async] Retrieves the list of users the file 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.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.get_shared_users(search='John', skip=0, limit=10)
async seed_cache(from_zoom=None, to_zoom=None, extent=None, workers=1)[source]

[async] Seed the cache of the mosaic.

Parameters:
  • from_zoom (int, optional) – The from zoom of the mosaic.

  • to_zoom (int, optional) – The to zoom of the mosaic.

  • extent (list[int], optional) – The extent of the mosaic.

  • workers (int, optional) – The number of workers to use. default is 1.

Returns:

The task of the seed cache.

Return type:

List[AsyncTask]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     task = await mosaic.seed_cache(from_zoom=0, to_zoom=22, extent=[0, 0, 100, 100], workers=1)
async clear_cache()[source]

[async] Clear the cache of the mosaic.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.clear_cache()
property cache_size: int

[async] Get the size of the cache of the mosaic.

Returns:

The size of the cache of the mosaic.

Return type:

int

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.mosaic import AsyncMosaic
>>> async with AsyncGeoboxClient() as client:
>>>     mosaic = await AsyncMosaic.get_mosaic(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await mosaic.cache_size