Skip to main content

Python SDK: maxar_platform

maxar_platform is a Python SDK for working with platform APIs.

Note: this replaces MGP-SDK, which will no longer be receiving updates.

Introduction

maxar-platform provides wrappers around the APIs with a focus on simplicity and productivity. It wraps popular and proven Python geospatial packages whenever possible, but also offers a core HTTP session object to use as a basis for more custom functionality.

APIs supported:

Discovery

Discovery is the catalog API. maxar_platform extends pystac-client to provide STAC search to the user.

Streaming APIs (OGC)

owslib methods are available for OGC access to imagery and image footprint OGC endpoints. In addition, maxar-platform provides a search client with a similar interface to the Discovery module that queries the images available from these endpoints

Ordering, Monitoring, and Tasking APIs

These endpoints can be accessed through matching modules and functions.

Raster Analytics

Open any image available in Raster Analytics with rasterio as if the image was a Cloud Optimized GeoTIFF. Pixel data is generated on-the-fly.

Authentication

An underlying session object handles authentication and communication with the APIs. Also included is a module for managing API Keys.

Installation

pip install maxar-platform

To use the Raster Analytics module, you will also need to install rasterio.

Python versions 3.9 - 3.11 are currently supported and tested against.

Authentication

The SDK can use either username/password credentials, or an API key. We highly recommend using API keys as they are longer lived. Some of the data access methods in the SDK can not refresh expired access tokens used by username/password OAuth system. Both types of authentication are transparently supported with preference give to API keys if present. Admin and Auth APIs only work with username/password credentials - API keys can not be used for their functionality.

Store your credentials using the following environment variables:

  • MAXAR_API_KEY

and/or

  • MAXAR_USERNAME
  • MAXAR_PASSWORD

If you are working in an interactive session like the Python console or a Jupyter notebook, you can call up a login form that will temporarily store your credentials in memory for the session.

from maxar_platform.session import session
session.login()