Skip to content

Example HTTP API

Routes, tile path format, style parameters, and response behavior.

The HTTP API belongs to examples/serve.rs; it is not part of the library’s dependency surface.

Routes

Method and pathPurpose
GET /tiles/{tms}/{z}/{x}/{y}.{ext}Render a tile from the selected single COG.
GET /mosaic/tiles/{tms}/{z}/{x}/{y}.{ext}Render a tile from the configured mosaic or STAC source.
GET /datasetsList local TIFF files discovered under data/.
GET /cache/statsReturn decoded-block cache statistics.
GET /formatsReturn output formats compiled into the server.
GET /boundsReturn bounds used by the example viewers.
GET, HEAD /data/{name}Serve a discovered local TIFF with range support.

Supported TMS names are WebMercatorQuad and WorldCRS84Quad. Supported style extensions are png and feature-gated lossless webp.

Raster Style Q3

Both tile routes require complete Q3: version=3.0&type=.... Unknown fields, old parameters, and unimplemented capabilities fail explicitly. dataset, mode, and _v are separate singleton context keys; asset URLs are not styles.

ParameterRepeatMeaning
version / typeno3.0 and gray/rgb/pseudocolor/categorized/single_color.
bidxyesOne-based source bands; RGB requires exactly three.
expressionnoOne expression for gray, three separated by semicolons for RGB; excludes bidx.
method / rescaleranges onlynone, linear, minmax, percentile, stddev, histogram_equalization, curve; see the styling guide for parameters and the shared statistics grid.
colormap_name / colormapnoPseudocolor maps; native tables use exact values or half-open intervals.
nodatanoFinite number or nan.
color_formulanoSupported Gamma operations, applied in order.
opacityno0–1; default 1.
resampling / reprojectnonearest, bilinear, cubic, cubic_spline, lanczos, average.
extensionsnoJSON array of exact versioned Schema URLs; percent-encode the value.
extension_fieldsnoJSON object containing raster:tile and/or raster:mosaic; percent-encode the value.

raster:tile supports tilesize (64, 128, 256, 512, 1024), format (png, or webp with lossless: true); the format must match the path. raster:mosaic requires pixel_selection and stage, with optional rank_channel for highest/lowest. Declare the Tile 1.0.0 and/or Mosaic 1.0.0 Schema URLs. The former tile/mosaic short parameters are rejected.

Encode literal + as %2B in raw Q3. Do not decode before concatenating query fragments. See the styling guide for semantics and limits.

Responses

  • 200 OK returns encoded image bytes.
  • 204 No Content means the coordinate is valid but fully outside the source dataset or projection domain.
  • Invalid style values and malformed coordinates return a client error with a structured library error behind it.

The default output size is 256×256, chosen for broad XYZ-client compatibility.