Skip to main content

Retrieving Tiles

Tiles are standard XYZ resources. Use the survey id plus z/x/y coordinates, then stream the PNG/JPEG response to disk, cloud storage, or a CDN cache.

Tile URL Template

https://api.nearspacelabs.net/tile/v2/{surveyid}/{z}/{x}/{y}

Specifications

SpecValue
Min zoom14
Max zoom21
FormatsPNG, JPEG
Tile size256 × 256 px

Download Examples

import requests

NSL_ID = "YOUR NSL ID"
NSL_SECRET = "YOUR NSL SECRET"
TILE_SERVER_URL = "https://api.nearspacelabs.net/tile/v2/2024Q4-FL-PTCH/{z}/{x}/{y}"

# Request a token and add it to the Authorization header
my_token = get_auth_token()
headers = {'Authorization': f'Bearer {my_token}'}

X = 71276
Y = 110648
Z = 18

with requests.get(
TILE_SERVER_URL.format(z=Z, x=X, y=Y),
headers=headers,
stream=True
) as req:
req.raise_for_status()
local_file = f'{Z}_{X}_{Y}.png'
with open(local_file, 'wb') as f:
for chunk in req.iter_content(chunk_size=8192):
f.write(chunk)