Sunday, August 5, 2018

[Code snippet]: Planet API Image Download Url

Be The First To Comment

from requests.auth import HTTPBasicAuth
import os
import requests


item_id = "20161109_173041_0e0e"
item_type = "PSScene3Band"


os.environ['PLANET_API_KEY'] = '3b711bededf6485a0' #not a real id
asset_type = "visual"
item_url = 'https://api.planet.com/data/v1/item-types/{}/items/{}/assets'.format(item_type, item_id)

# Request a new download URL
result = requests.get(item_url, auth=HTTPBasicAuth(os.environ['PLANET_API_KEY'], ''))
download_url = result.json()[asset_type]['location']

print(download_url)
 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me