Layer Preview
Tilegroxy can generate a standalone HTML page previewing a single layer on a MapLibre map, so you can visually confirm that a layer works without a separate GIS client.
The preview page is a development aid and is only available when Server.Production is false.
|
Endpoint
/preview/{layer} returns the preview page for a single layer, relative to the root path configured in server configuration.
The Map
The page loads MapLibre GL JS from CDN and points a layer at the /tiles/{layer}/{z}/{x}/{y} endpoint. If TileJSON is enabled, it will use the configured metadata (such as bounds) to frame it. When there are no bounds the map uses the provider’s center if it has one, otherwise the whole world.
A vector layer is rendered with a plain outline style. Layers with the mlt datatype are loaded as MapLibre Tiles, anything else vector is loaded as MVT. If the provider lists the layers inside its tiles (the vectorlayers metadata), each of those layers is drawn in its own color. Otherwise we make an effort to guess the layer name (the layer inside the MVT or MLT tiles themselves). If it guesses wrong, styling won’t apply and you’ll see nothing. Add ?name= to the URL to set the source-layer name explicitly instead.
Security
The preview likely won’t work with authentication enabled as we don’t pass along the incoming authentication to subsequent tile requests. This is really just meant as a dev tool before you get to that level.
The preview endpoint itself does go through the same authentication check as a tile request, and respects the same authorization controls as a tile request. So if you do accidentally leave this on, it won’t meaningfully expose you.