Package: planet-basemap
Planet Mosaic Quads Download toolPlanet creates global monthly mosaics apart from creating mosaics at different frequencies, monthly
mosaics are of interest to a lot of people who would like to do a consistent time series analysis using
these mosaics and would like to apply them to an existing analytical pipeline.This tool allows listing and download Mosaic Quads for given geometries.
AllGDAL vector formatsare supported.As a result you can get all the quads for given geometry bounding box:Or if you use--intersec_exactoption all:Note that this repo is a fork of thefollowing projectyou can cite it as:Samapriya Roy. (2019, June 25). samapriya/Planet-Mosaic-Quads-Download-CLI: Planet Mosaic Quads Download CLI (Version 0.1.0). Zenodo.
http://doi.org/10.5281/zenodo.3255274Table of contentsInstallationGetting started[planet_basemap CLI tool](#planet_basemap CLI tool)bounding boxlistdownloadPython APIInstallation** Install Fiona and GDAL for windows using the whl fileshere** if
there are any issues during installation.This assumes that you have native python & pip installed in your system, you can test this by going to the
terminal (or windows command prompt) and trying:pythonand thenpip listIf you get no errors and you have python 3.5 or higher you should be good to go.To installpbasemap: Planet Mosaic Quads Download CLIyou can install using two methodspip install planet-basemapor you can also trygit clone https://github.com/SatAgro/planet-basemaps.git
cd planet-basemaps
python setup.py installInstallation is an optional step; the application can be also run directly by executing planet_basemap.py
script. The advantage of having it installed is being able to execute ppipe as any command line tool.
I recommend installation within virtual environment. If you don't want to install, browse into the
pbasemap folder and trypython plabet_basemap.pyto get to the same result.To avoid introducing--api_keyoption for each command you can setupPL_API_KEYenvironment variable.Getting startedAs usual, to print help:usage: planet_basemap.py [-h] {rbox, list, download} ...

Planet Mosaic Quads Download CLI

positional arguments:
  {rbox , list, download}
    rbox                Prints bounding box for geometry
    list                Tool to get Mosaic Quads with Bounding Boxes and other metadata.
    download            Download quad GeoTiffs choose from name or idlist

optional arguments:
  -h, --help            show this help message and exitTo obtain help for a specific functionality, simply call it withhelpswitch, e.g.:planet_basemap list -h.
If you didn't install pbasemap, then you can run it just by going topbasemapdirectory and
runningpython planet_basemap.py [arguments go here]CLI toolThe tool allows you to list and download basemap quads that intersect with area of interest, and have
controls such as date range and check for final coverage before download. The CLI also allows you to export
the mosaics list as needed and can handle GeoJSON and KML files, and includes a tool to convert shapefiles
to GeoJSON files for use with this tool.bounding boxThis tool simply prints the bounding box for any geometry feature that is passed. This is useful if you are
using the planet CLI to downlaod quads which requires a bounding box.It prints out the bounding box for use.usage: planet_basemap.py rbox [-h] [--geometry GEOMETRY]

optional arguments:
  -h, --help           show this help message and exit
  --geometry GEOMETRY  Choose a geometry file supports GeoJSON, KMLlistThis tool exports all quads that intersect with your geometry file. You can use any input and output geometryfile format supported by GDAL.usage: planet_basemap.py list [-h] --geometry GEOMETRY --start START --end END [--coverage COVERAGE] 
                              [--intersect_exact] --output OUTPUT [--api_key API_KEY]


arguments:
  -h, --help           show this help message and exit
  --geometry GEOMETRY  Path to AOI geometry file (any supported by GDAL)
  --start START        Choose Start date in format YYYY-MM-DD
  --end END            Choose End date in format YYYY-MM-DD
  --coverage COVERAGE  Optional. Choose minimum percentage coverage. Default: 0
  --intersect_exact    Optional. Filter quads that intersects with AOI. If not given quads for entire AOI bounding box are returned.
  --output OUTPUT      Full path where you want your mosaic list exported.
  --api_key API_KEY    Planet API key. Also can be set as PL_API_KEY env var.download mosaicAs the name suggests this downloads your mosaic to the local folder you specify, you can specify how much
coverage you want over your geometry and over the quad. So you may decide to only download those mosaic
quads that have coverage more than 90% by simply specifying--coverage 90in the arguments.You can also download a list of mosaics get with thelistoption by using the--listargument.usage: planet_basemap.py download [-h] [--geometry GEOMETRY] [--list LIST] [--start START] [--end END] 
                                  [--coverage COVERAGE] [--intersect_exact] [--override] [--output OUTPUT] 
                                  [--api_key API_KEY]

options:
  -h, --help           show this help message and exit
  --geometry GEOMETRY  Path to AOI geometry file (any supported by GDAL like shapefile, GeoJSON, etc.)
  --list LIST          Mosaic list where results from list command where saved
  --start START        Choose Start date in format YYYY-MM-DD
  --end END            Choose End date in format YYYY-MM-DD
  --coverage COVERAGE  Choose minimum percentage coverage
  --intersect_exact    Filter quads that intersects with AOI. If not given quads for entire AOI bounding box are returned.
  --override           To override already downloaded quads.
  --output OUTPUT      Local folder where downloaded data will be stored
  --api_key API_KEY    Planet API key. Also can be set as PL_API_KEY env var.Python APIYou can also call directly base map mosaic quad list and download functions in you python code.
Bellow you can find an example that lists and download quad data. For more documentation check the code.fromdatetimeimportdatefromplanet_basemap.mosaic.downloadimportdownload_mosaic_quadsfromplanet_basemap.mosaic.metadataimportget_file_mosaic_quads_metadataquads=get_file_mosaic_quads_metadata('./data/test_aoi_01.geojson',date(2022,1,1),date(2022,3,1))# Do some staff (e.g. filter) with your quads and then downloaddown_paths=download_mosaic_quads(quads,'./download')Or just in one step:fromdatetimeimportdatefromplanet_basemap.mosaic.downloadimportdownload_aoi_file_mosaic_quadsdown_files=download_aoi_file_mosaic_quads('./data/your_aoi_shape.shp','./download',date(2022,1,1),date(2022,3,1),coverage=50,intersect_exact=False,override=False)Changelogv1.0.1Renamed package toplanet_basemapto avoid conflicts with legacy versionsImproved docs and tests.v1.0.0Added native support for almost any vector-based format (same as GeoPandas).Download only intersecting quads (if specified).One-step download.Drop multipart downloader.v0.1.0Improvements to installationNow creates folders to download mosaic quadsFixed issue with multipart downloaderv0.0.8Minor improvementsChecks for download permissionv0.0.7Updated feedback, major changes to the codebase and underlying methodologyOptimized code for search and downloadOverall improvements to code and major revisionsv0.0.5Complete change to the codebase and underlying methodologyOptimized code for search and downloadOverall improvements to code and major revisionsv0.0.4Fixed projection issue for shapefilesOptimized code for shapefile to geojson exportOverall improvements to code and minor revisions