175 wind turbines make up the London Array—the world’s largest offshore wind farm.
AUTHOR PROFILE Benjamin Trigona-Harany
Curious Planeteer working to make the Earth's changes visible, accessible and actionable.

Python Client Now Supports Planet Data API


Good news for developers: new versions of our Python and JavaScript clients are now available for use! Both have been upgraded to support Planet’s Data API—the API on which we built Planet Explorer and through which we serve PlanetScope, RapidEye, Landsat8, and Sentinel-2 data. In providing these two projects, we want to make it easier for developers to build applications on top of the Planet API.

command line—ben

Planet’s data pipeline from space to app</font size= “-1”>

Up First: The Python Client

While both clients will help developers, the Python client also provides a stand-alone command-line interface tool that lets users browse our catalog and download images directly without having to create API requests.

We are distributing the latest version of the Python client in a few different ways. The simplest way for most users will be to install directly with pip:

pip install planet

Our releases page also lets users download the source code or a Python Executable. To get started with the command-line tool, here are a few examples to illustrate what users can do:

Start by setting up your credentials:

planet init
Email: xxxxx@planet.com
Password: xxxxxxxxxxxxxx

The planet command breaks up functionality into a number of subcommands, the most important of which is data, since the client’s current focus is supporting the Data API. To explore all the available options, run the following:

planet data
Usage: planet data [OPTIONS] COMMAND [ARGS]...

  Commands for interacting with the Data API

  --help  Show this message and exit.

  create-search  Create a saved search
  download       Activate and download
  filter         Output a AND filter as JSON to stdout.
  saved-search   Execute a saved search
  search         Execute a quick search.
  searches        List searches
  stats           Get search stats


Next Steps

There is a lot to take in here, but we can focus on what is probably the primary workflow: searching for and downloading data. To make the example simple, let’s just download the most recently published PlanetScope 4-band analytic image with an estimated cloud cover of less than 10%:

planet data download --limit 1 --item-type PSScene4Band --asset-type 
analytic --range cloud_cover lt 0.1

The client will automatically activate the file if necessary and then download it right to the current directory.
If you just want to see the metadata from the same search, swap out download for search.

planet data search --limit 1 --item-type PSScene4Band --asset-type analytic --range cloud_cover lte 0.1

In addition to a complete reference, the module’s documentation also contains a number of examples of both the command-line tool in action and code written using the library.

Planet’s Python client is developed in an open git repository; feel free to drop by and submit feature requests or file bug reports!

command line—ben
Try this yourself; and—if you haven’t already—apply for our Application Developer Program.