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 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: email@example.com Password: xxxxxxxxxxxxxx initialized
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 Options: --help Show this message and exit. Commands: 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
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!
Try this yourself; and—if you haven’t already—apply for our Application Developer Program.