Adding Planet global monthly and quarterly mosaic
Uncomment the following line to install leafmap if needed.
# !pip install leafmap
import os
import leafmap
First, you need to sign up a Planet account and get an API key. See https://developers.planet.com/quickstart/apis. Uncomment the following line to pass in your API key.
# os.environ["PLANET_API_KEY"] = "12345"
Determine the tile format based on the plotting backend being use. It can be either ipyleaflet or folium.
tile_format = "ipyleaflet"
if os.environ.get("USE_MKDOCS") is not None:
tile_format = "folium"
Generate Planet quarterly imagery URLs.
# leafmap.planet_quarterly()
Generate Planet monthly imagery URLs.
# leafmap.planet_monthly()
Generates Planet bi-annual and monthly imagery URLs.
# leafmap.planet_catalog()
Generate Planet quarterly imagery TileLayer.
quarterly_tiles = leafmap.planet_quarterly_tiles(tile_format=tile_format)
Generate Planet monthly imagery TileLayer.
monthly_tiles = leafmap.planet_monthly_tiles(tile_format=tile_format)
Print out the quarterly tile URLs.
for tile in quarterly_tiles:
print(tile)
Print out the monthly tile URLs.
for tile in monthly_tiles:
print(tile)
Add a Planet monthly mosaic by specifying year and month.
m = leafmap.Map()
m.add_planet_by_month(year=2020, month=8)
m
Add a Planet quarterly mosaic by specifying year and quarter.
m = leafmap.Map()
m.add_planet_by_quarter(year=2019, quarter=2)
m