REST API Reference#
localtileserver exposes a comprehensive REST API built on
FastAPI. Interactive API documentation
is available at /swagger/ when the server is running.
Core Tile Endpoints#
These endpoints serve tiles and metadata for raster files specified via the
filename query parameter. If no filename is provided the server falls
back to the file configured at startup (via app.state.filename) or the
built-in San Francisco Bay example data.
Endpoint |
Method |
Description |
|---|---|---|
|
GET |
Serve a single map tile at the given zoom/x/y coordinates. |
|
GET |
Serve a thumbnail preview of the entire raster. |
|
GET |
Return raster metadata (CRS, bounds, band info, dtype, etc.). |
|
GET |
Return geographic bounds in a specified CRS. |
|
GET |
Return per-band statistics (min, max, mean, std, histogram). |
|
GET |
Validate whether the file is a Cloud Optimized GeoTIFF. |
|
GET |
List all available color palettes. |
|
GET |
Extract a bounding box crop from the raster. |
|
POST |
Extract data masked to a GeoJSON feature (POST body). |
Common Query Parameters#
Most tile, thumbnail, and statistics endpoints accept these parameters:
Parameter |
Description |
|---|---|
|
Path or URL to the raster file. |
|
Comma-separated band indexes (e.g., |
|
Colormap name (e.g., |
|
Minimum value for rescaling (comma-separated for per-band values). |
|
Maximum value for rescaling (comma-separated for per-band values). |
|
Override the fileβs nodata value. |
|
Band math expression (e.g., |
|
Stretch mode: |
Endpoint-Specific Parameters#
/api/bounds#
Parameter |
Description |
|---|---|
|
Output coordinate reference system (default: |
/api/thumbnail.{fmt}#
Parameter |
Description |
|---|---|
|
Maximum pixel dimension of the thumbnail (default: |
|
Reproject the thumbnail to this CRS before returning. |
/api/part.{fmt}#
Parameter |
Description |
|---|---|
|
Required. Bounding box as |
|
Maximum pixel dimension of the output image (default: |
|
CRS of the |
|
CRS to reproject the output image into. |
/api/feature.{fmt}#
Parameter |
Description |
|---|---|
|
Maximum pixel dimension of the output image (default: |
|
CRS to reproject the output image into. |
The POST body must be a GeoJSON feature object used to clip the raster.
Output Formats#
The {fmt} path parameter controls the output format:
pngβ PNG (default)jpeg/jpgβ JPEGwebpβ WebPtif/tiff/geotiffβ GeoTIFFnpyβ NumPy array
STAC Endpoints#
Endpoints for visualizing STAC catalog items.
Endpoint |
Method |
Description |
|---|---|---|
|
GET |
Get STAC item metadata and available assets. |
|
GET |
Get per-asset/band statistics. |
|
GET |
Serve tiles from a STAC itemβs assets. |
|
GET |
Serve a thumbnail from a STAC item. |
Parameter |
Description |
|---|---|
|
Required. URL pointing to the STAC Item JSON. |
|
Comma-separated asset names to include (e.g., |
|
Band math expression over asset names (e.g., |
|
Maximum pixel dimension of the thumbnail (default: |
Xarray Endpoints#
Endpoints for serving tiles from in-memory xarray DataArrays. DataArrays must
be pre-registered in the serverβs xarray_registry before use.
Endpoint |
Method |
Description |
|---|---|---|
|
GET |
Get DataArray metadata. |
|
GET |
Get per-band statistics. |
|
GET |
Serve tiles from a registered DataArray. |
|
GET |
Serve a thumbnail from a registered DataArray. |
Parameter |
Description |
|---|---|
|
Registry key identifying the DataArray. If only one DataArray is registered the key may be omitted. |
|
Comma-separated band indexes to include. |
|
Maximum pixel dimension of the thumbnail (default: |
Mosaic Endpoints#
Endpoints for creating virtual mosaics composited from multiple raster files.
Endpoint |
Method |
Description |
|---|---|---|
|
GET |
Serve mosaic tiles composited from multiple raster files. |
|
GET |
Serve a mosaic thumbnail. |
Parameter |
Description |
|---|---|
|
Comma-separated file paths or URLs to mosaic. If omitted the server
falls back to |
|
Comma-separated band indexes to include. |
|
Maximum pixel dimension of the thumbnail (default: |
Interactive Documentation#
When the server is running, visit /swagger/ for the full interactive
OpenAPI documentation. This is auto-generated by FastAPI and allows you to
try out all endpoints directly in your browser.