To get the XYZ URL, request it using API Tile Services.
The API Tile Service and Basemap Tile Service make it easy to visualize Planet imagery in desktop or web mapping applications that support either the XYZ or WMTS protocol. These services offer a low-friction way for web developers and GIS analysts to interact with, and derive value from Planet imagery without the need for further image processing.
More information is available in the Tile Services Overview.
An Example Request in Python
API Tile Service Request Structure
https://tiles1.planet.com/data/v1/PSScene3Band/20161221_024131_0e19/14/12915/8124.png?api_key={api-key}
API Tile Service Request in Python with Basic HTTP Authentication
import os
# import os module to access enviornmental 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 |
Comments
Please sign in to leave a comment.