Module maxar_platform.raster_analytics
Provides
Pre-configured access to Raster Analytics via Rasterio.
Note
Raster Analytics, while technically an API, is better understood as a virtual Cloud Optimized GeoTIFF service that renders the tiles inside a virtual COG as they are requested by a client. Think of it as instead of ordering a large image, you can instead order small bites of the image "a la carte". In essence, every tile read operation is its own miniature order.
However, because every small tile is made to order, how you interact with the tiles becomes important.
This module provides a Rasterio DatasetReader that is configured with the correct settings to interact with Raster Analytics. When you open or read from a virtual COG, the correct GDAL settings are temporarily applied to receive the API response and then are reset. This means that the specific settings for reading data from Raster Analytics will inadvertently apply to other GDAL operations you may be using, such as writing an output image from the data.
Note: to return a window of X by Y pixels requires fetching enough tiles to cover the window. You are billed based on tiles fetched, and for small windows this can result in data usages that are larger than the window size requested in the function.
The COG_ENV constant contains the correct GDAL settings for Rasterio should you need to apply them to other
reader implementations. To build correctly formatted and escaped URLs, the build_url
function may also be
useful when combined with other clients that can read GeoTIFFs.
Reference
https://developers.maxar.com/docs/analytics/raster/guides/raster-analytics-overview
Variables
COG_ENV
: GDAL envvars optimized for reading virtual geotiffs.
Note: these use Python formatting for Rasterio.Env, for example True instead of 'true'
Functions
build_url(script, function, collect_identifier, crs=None, **params)
: Build a Raster Analytics URL
Parameters
----------
script : str
Script name
function: str
Function name
collect_identifier : str
Catalog ID
crs : str
Coordinate reference system code. Ex: 'EPSG:4326'
Keywords
--------
Additional keywords are passed as function parameters to the API
Returns
-------
str
Formatted and escaped URL for the image
open_image(pipeline, collect_identifier, crs=None, params={}, **kwargs)
: Configure and return a Rasterio DatasetReader
Parameters
----------
pipeline : str
Script and function name formatted like pipelines with a slash. Ex: 'ortho/pansharp_ortho'
collect_identifier : str
Catalog ID
crs : str
Coordinate reference system code. Ex: 'EPSG:4326'
Keywords
--------
Additional keywords are passed as function parameters to the API
Returns
-------
rasterio.DatasetReader