Imagery
The Streaming Imagery API service makes Maxar content immediately available via HTTPs and OGC WMS, WMTS, and WFS standards. The customer provides required parameters for each respective implementations via the API, whereby the respective file format and tiles are returned for streaming integrations across a range of applications and industries. For more information on OGC
Getting Started:
from MGP_SDK.interface import Interface
streaming = Interface().streaming
Package methods:
- Search
- Download Image
- Get Tile List With Zoom
- Download Browse Image
- Get Full Resolution Image
- Download Image by Pixel Count
Search
search()
Function searches using the wfs method
Returns: Response is either a list of features or a shapefile of all features and associated metadata.
Args:
- srsname: (str) Default=EPSG:4326, Desired projection
- bbox: (str) Default=None, Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
- filter: (str) Default=None, CQL filter used to refine data of search.
- shapefile: (bool) Default=False, Binary of whether or not to return as shapefile format
- csv: (bool) Default=False, Binary of whether or not to return as a csv format
Keyword Arguments:
- featureprofile: (str) The desired stacking profile. Defaults to account Default
- typename: (str) The typename of the desired feature type. Defaults to FinishedFeature. Example input
MaxarCatalogMosaicProducts
from MGP_SDK.interface import Interface
streaming = Interface().streaming
features = streaming.search(bbox='4828743.9944,-11689315.9992,4831803.1702,-11685446.3746', srsname='EPSG:3857',
filter="(acquisitionDate>='2022-01-01')AND(cloudCover<0.20)")
print(features)
Download Image
download_image()
Function downloads the image using an ogc method depending on the parameters passing in
Returns: requests response object or downloaded file path
Args:
- bbox (str): Default=None, Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
- srsname (str): Default=EPSG:4326, Desired projection
- height (int): Default=512, The vertical number of pixels to return
- width (int): Default=512, The horizontal number of pixels to return
- img_format (str): Default=jpeg, The format of the response image either jpeg, png or geotiff
- zoom_level (int): Default=None, The zoom level. Used for WMTS
- download (bool): Default=True, User option to download image file locally
- outputpath (str): Default=None, Output path must include output format. Downloaded path default is user home path.
- display (bool): Default=False, Display image in IDE (Jupyter Notebooks only)
Keyword Arguments:
* legacyid: (str) The duc id to download the browse image
from MGP_SDK.interface import Interface
streaming = Interface().streaming
image = streaming.download_image(bbox='4828743.9944,-11689315.9992,4831803.1702,-11685446.3746', srsname='EPSG:3857',
height=1024, width=1024, img_format='png', display=True)
Get Tile List With Zoom
get_tile_list_with_zoom()
Function acquires a list of tile calls dependent on the desired bbox and zoom level
Returns: List of individual tile calls for desired bbox and zoom level
Args:
- bbox (str): Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
- zoom_level (int): The zoom level
- srsname (str): Default=EPSG:4326, Desired projection
from MGP_SDK.interface import Interface
streaming = Interface().streaming
tile_list = streaming.get_tile_list_with_zoom(bbox='4828743.9944,-11689315.9992,4831803.1702,-11685446.3746',
srsname='EPSG:3857', zoom_level=8)
print(tile_list)
Download Tiles
download_tiles()
Function downloads all tiles within a bbox dependent on zoom level
Returns: Message displaying success and location of downloaded tiles
Args:
* bbox (str): Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
* zoom_level (int): The zoom level
* srsname (str): Default=EPSG:4326, Desired projection
* img_format (str): Default=jpeg, The format of the response image either jpeg, png or geotiff
* outputpath (str): Default=None, Output path must include output format. Downloaded path default is user home path.
* display (bool): Default=False, Display image in IDE (Jupyter Notebooks only)
from MGP_SDK.interface import Interface
streaming = Interface().streaming
streaming.download_tiles(bbox='4828743.9944,-11689315.9992,4831803.1702,-11685446.3746', srsname='EPSG:3857',
zoom_level=8, img_format='geotiff')
Download Browse Image
download_browse_image()
Function downloads the browse image for the desired legacy id
Returns: Downloaded image location of desired legacy id in desired format
Args:
- input_id (str): The desired input id (Can be feature id or catalog id)
- img_format (str): Default=jpeg, The format of the response image either jpeg, png or geotiff
- outputpath (str): Default=None, Output path must include output format. Downloaded path default is user home path.
- display (bool): Default=False, Display image in IDE (Jupyter Notebooks only). Default False
from MGP_SDK.interface import Interface
streaming = Interface().streaming
streaming.download_browse_image(input_id='7327845623467', img_format='png', outputpath=r'C:/myUser/Downloads/Test')
Get Full Resolution Image
get_full_res_image()
Function takes in a feature id and breaks the image up into 1024x1024 tiles, then places a number of calls based on
multithreading percentages to return a full image strip in multiple tiles
Returns: None
Args:
- featureid (str): Feature id of the image
- thread_number (int): Default=25, Number of threads given to multithread functionality.
- bbox (str): Default=None, Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
- mosaic (bool): Default=False, Flag if image files are mosaiced.
- srsname (str): Desired projection. Defaults to EPSG:4326
Keyword Arguments:
- outputdirectory (str): Output location for tiles
- image_format (str): Image format (png or jpeg)
- filename (str): Filename for output mosaiced image
from MGP_SDK.interface import Interface
streaming = Interface().streaming
streaming.get_full_res_image(featureid='345757345634', thread_number=125,
bbox='39.906477,-105.010843,39.918031,-104.991939', mosaic=True, image_format='geotiff')
Download Image by Pixel Count
download_image_by_pixel_count()
Function downloads the image of desired bbox dependent on pixel height and width
Returns: Message indicating the location of the downloaded file.
Args:
- bbox (str): Bounding box of AOI. Comma delimited set of coordinates. (miny,minx,maxy,maxx)
- height (int): The vertical number of pixels to return
- width (int): The horizontal number of pixels to return
- srsname (str): Desired projection. Defaults to EPSG:4326
- img_format (str): Default=jpeg, The format of the response image either jpeg, png or geotiff
- outputpath (str): Output path must include output format. Downloaded path default is user home path.
- display (bool): Display image in IDE (Jupyter Notebooks only). Defaults to
False
Kwargs: * filter: CQL filter used to refine data of search. * featureprofile: The desired stacking profile. Defaults to account Default
from MGP_SDK.interface import Interface
streaming = Interface().streaming
feature_id = '932f7992a4d86a9ca412c024c22792ce'
aoi = '39.906477,-105.010843,39.918031,-104.991939'
cql_filter = "featureId='{}'".format(feature_id)
download = streaming.download_image_by_pixel_count(bbox=aoi, height=512, width=512, img_format='jpeg', filter=cql_filter)
print(download)