![titiler-logo](../_static/services/titiler_logo.png) # How to use TiTiler ## Install ``` pip install httpx ``` ## Generate a tile URL and preview image ```python import httpx titiler_endpoint = "https://titiler.services.eodc.eu" asset_href = "https://data.eodc.eu/collections/BOA_LANDSAT_8/X0013_Y0014/20201231_LEVEL2_LND08_BOA.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,255", "bidx": 1, "bidx": 2, "bidx": 3}, ).json() # Generate a preview image of the data r = httpx.get( f"{titiler_endpoint}/cog/preview.png", params={"url": asset_href, "rescale": "0,255", "bidx": 1, "bidx": 2, "bidx": 3}, ) ``` **Step by step:** 1. `asset_href` — a direct URL to a Cloud-Optimized GeoTIFF (COG). 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 pixel value range to 0–255 for display. Adjust to match your dataset's value range. 5. `bidx` — selects which bands to render. Pass up to 3 band indices for an RGB composite. ## 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/docs`.