How to Get XYZ URL for a Specific Scene/Item?

To get the XYZ URL, request it using API Tile Service.

The API Tile Service acts as an extension to the Planet API by visually listing the Planet assets that are available in the item archive as tiles. The imagery returned by the tile service is a compressed version of the high-quality visual asset, making it easy to incorporate into any supporting client. Currently, only clients using the XYZ tile protocol are supported.

API Tile Service Request Structure

https://tiles{0-3}.planet.com/data/v1/{item_type}/{item_id}/{z}/{x}/{y}.png?api_key={api-key}

API Tile Service Request in Python with Basic HTTP Authentication

import os
# import os module to access environmental modules

import requests
from requests.auth import HTTPBasicAuth
# import helper functions to make Basic request to Planet API

PLANET_API_KEY = os.getenv('PL_API_KEY')
# Setup the API Key from the `PL_API_KEY` environment variable

BASE_URL = 'https://tiles{0-3}.planet.com/data/v1/{item_type}/{item_id}/{z}/{x}/{y}.png'

if PLANET_API_KEY is None:
    PLANET_API_KEY = '12345'
# pass in your API key

auth = HTTPBasicAuth(PLANET_API_KEY, '')
# HTTPBasicAuth() wants a username & password; you can pass an empty string for the password

res = requests.get(url=BASE_URL, auth=auth)

print(res.status_code)
# make a request to Tile Services API and test the response
Parameter Value
item_type Item type of the item to view.
item_id Item id of the item to view.
z Tile zoom level.
x Tile row in the grid.
y Tile column in the grid.

The following example is a complete URL for a tile request for the PSScene item with an id of 20161221_024131_0e19:

API Tile Service Example

https://tiles1.planet.com/data/v1/PSScene/20161221_024131_0e19/14/12915/8124.png?api_key={api-key}


More information is available in the
Tile Services Overview.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.