Lago Itaipu, Brazil Planet Labs ©

All about that Base-map

Samapriya Roy
5 min readMay 7, 2019

Basemaps are extremely useful to understand underlying change in landscape and with high temporal frequency, Planet’s monthly, quarterly base maps allow for the most updated set composite view of the planet. Though basemaps are visual products there have been interesting applications of basemaps for Machine Learning training data along with change detection, which is not dependent on pure spectral methods for classification and object detection. To that end, downloading basemap quads depending on your access is key and useful. Planet’s python command line tool allows for this functionality and more. In this article, I will go through some of the commonly found tools within Planet Python Command Line Interface (CLI) along with introducing my own tool as an add-on for additional functions. Throughout the article basemap and mosaics are used interchangeably.

Planet Mosaics from Planet Python CLI

The Planet Basemap online tool allows you to interact with the mosaics API and download quads. Thought this is quite efficient, you might need to bring in some level of automation and batching which is provided with the Planet Python CLI. If you want to read about this, I recommend one of my other articles on Demystifying Planet Command Line Interface.

planet mosaics

The mosaics tool allows you to download quads from a mosaic, get information about a specific mosaic, list all available mosaics and more to name a few of the options.

planet mosaics

A simple search function with a bounding box will yield mosaics that intersects with your AOI. If you want to list all mosaics that are available for you simply go with the following setup. The — -p uses pretty print to get the results.

planet mosaics list --p
planet mosaics search

To download the mosaic quads use the downloads tool, this requires the bounding box, the name of the mosaic, destination directory and you can limit the number of quads you would like to download.

planet mosaics download tool

Additional features such as contribution prints contributing scenes to a mosaics quad while info and quad-info print information about specific mosaic and specific mosaic quad respectively.

pbasemap as addon

While the “planet mosaics tools” are great, you can quickly gauge from the setup that you cannot pass a geometry feature or get the bounding box from the tool. The instructions to install the tool and the project can be found here. A simple setup would be

pip install pbasemap

The setup requires additional instructions for setting up GDAL and fiona and instruction are included in the ReadMe.

pbasemap

Getting the bounds and the box

To get at the bounding box issue, you can get the bounding box using the rbox tool. The tool can handle GeoJSON files and KML.

pbasemap rbox to get bounding box

Give me the mosaic list

To get at the basemap search but using a geometry means you should be able to look for all basemaps that intersects your geometry. You should also be able to specify the time to constrain your search and importantly export the mosaics list as an output, to use and to download all mosaics iteratively instead of specifying mosaic names.

pbasemap mosaic list with date filter and geometry to use as bounds

Now Downloading…..

The next steps bring in the downloading functions, and here the choice is completely yours, I included a multipart downloader to speed things up sometimes, but the downloader itself should work just fine. The setup for both these tools are the same and include some additional features. Not only can you specify your geometry again, this time to check for intersection, it now also filters using coverage metadata. The metadata list you created earlier can be edited and passed to the downloader to download all mosaics quads that intersect with your AOI, or you can specify a mosaic name.

pbasemap downloader

Formats exchange

This was an addon to simply allow you to batch convert all shapefiles in a folder to GeoJSON files. Which can then be used with the pbasemap tool or any other tool that requires a GeoJSON geometry.

pbasemap shp2geojson tool

The addon serves as a feature extension that can be built by using the API endpoints and there are developer docs and API reference which can be found here. Hope this helps summarize most of the commands and options to run using the command line. Cite the tool, or star it on GitHub if you find it useful and use it as it allows me to understand usage and develop better tools based on use cases.

Samapriya Roy. (2019, April 17). samapriya/Planet-Mosaic-Quads-Download-CLI: Planet Mosaic Quads Download CLI (Version 0.0.7). Zenodo. http://doi.org/10.5281/zenodo.2643056

If you find this guide useful please click the clap 👏 button a couple of times below to show your support (You can click more than once :D ) ! and if you have used it to recreate something or to create a better workflow, let me know.

--

--

Samapriya Roy
Samapriya Roy

Written by Samapriya Roy

Remote sensing applications, large scale data processing and management, API applications along with network analysis and geostatistical methods