titiler-logo

How to use TiTiler

Install

pip install httpx

Generate a tile URL and preview image

import httpx

titiler_endpoint = "https://titiler.services.eodc.eu"
asset_href = "https://data.eodc.eu/collections/GFM_REFWATER/V04/EQUI7_EU020M/E051N012T3/REFERENCE_WATER_OUT_S1-_IW_GRDH_1S-V_20171002T051750_20211031T165858_MONTH-_E051N012T3_EU020M_V04.tif"

# Get a TileJSON with a tiles layer for use in a map application
r = httpx.get(
    f"{titiler_endpoint}/cog/tilejson.json",
    params={"url": asset_href, "rescale": "0,2", "colormap_name": "blues"},
).json()

# Generate a preview image of the data
r = httpx.get(
    f"{titiler_endpoint}/cog/preview.png",
    params={"url": asset_href, "rescale": "0,2", "colormap_name": "blues"},
    timeout=60,
)

Step by step:

  1. asset_href — a direct URL to a Cloud Optimized GeoTIFF (COG), here the reference_water_mask asset of a GFM item. You can obtain asset URLs from STAC items via the eodc STAC API.

  2. /cog/tilejson.json — returns a TileJSON descriptor with an XYZ tile URL that you can plug into Leaflet, MapLibre, or QGIS.

  3. /cog/preview.png — renders a small preview image of the full extent of the file.

  4. rescale — maps the pixel value range to 0–255 for display. Adjust to match your dataset’s value range.

  5. colormap_name — colours a single-band file. For an RGB composite of a multi-band file, pass bidx three times instead (params=[("url", asset_href), ("bidx", 1), ("bidx", 2), ("bidx", 3)]).

Tips

  • TiTiler works with any publicly accessible COG, not just eodc data.

  • Use the /cog/statistics endpoint to inspect a file’s value range before choosing rescale values.

  • The full TiTiler API is documented at https://titiler.services.eodc.eu/api.html.