Services and clients
Every published layer is a set of standard services. Copy the addresses from the layer’s Publishing tab (card Service endpoints); the OGC Services page lists every service with its version and status.
Services
Section titled “Services”{id} is the layer’s id or its readable workspace:name form.
| Service | Version | Address |
|---|---|---|
| WMS, layer | 1.1.1 | /api/v2/layers/{id}/wms |
| WMS, layer group | 1.1.1 | /api/v2/layer-groups/{id}/wms |
| WFS, layer | 2.0.0, 1.1.0, 1.0.0 | /api/v2/layers/{id}/wfs |
| WFS, workspace | 2.0.0, 1.1.0, 1.0.0 | /api/v2/workspaces/{id}/wfs |
| WCS, raster layer | 2.0.1, 1.1, 1.0.0 | /api/v2/layers/{id}/wcs |
| WMTS | 1.0.0 | /api/v2/mapcache/wmts?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0 |
| XYZ | /api/v2/mapcache/gmaps/{ref}@GoogleMapsCompatible/{z}/{x}/{y}.png |
|
| TMS | 1.0.0 | /api/v2/mapcache/tms/1.0.0/{ref}@GoogleMapsCompatible/{z}/{x}/{y}.png (rows counted from the south) |
| Vector tiles | TileJSON 3.0.0 | /api/v2/layers/{id}/mvt/tilejson.json, /mvt/style.json, /mvt/{z}/{x}/{y}.pbf |
WFS is read-only: the type name is ms:{service name}, a request returns at most 10,000 features, and there is no WFS-T.
Elevation layers, ENC charts and 3D tilesets have their own addresses on their own pages:
| Data | Addresses (on the Access tab) | For |
|---|---|---|
| Elevation | TileJSON and Terrain-RGB tiles | MapLibre, Mapbox, deck.gl |
| Quantized Mesh | CesiumJS (CesiumTerrainProvider) |
|
| WCS | QGIS, GDAL | |
WMS, tiles, DTED files, terrain.json |
Other clients; terrain.json lists them all |
|
| ENC chart | WMS and tiles | Any WMS or XYZ client |
| 3D tileset | tileset.json |
Cesium3DTileset.fromUrl, deck.gl Tile3DLayer |
Sign in with an API token
Section titled “Sign in with an API token”Clients outside the console send a read-only API token.
- Open API Tokens and press New token.
- Choose how long it lasts: 30 days, 90 days, 1 year or never.
- Copy the token. It is shown once, and starts with
loka_.
Send it in one of two ways:
Authorization: Bearer <token>- HTTP Basic: your user name, with the token as the password
A token can only read (GET and HEAD) map services. It has your role and your workspace access, and it never opens the console API. You can revoke it at any time.
| Answer | Why |
|---|---|
| 401 | No token, or a wrong one |
| 405 | Anything other than a read |
| 429 | Too many wrong tokens in a row; wait and try again |
- In QGIS: Layer → Add Layer → Add WMS/WMTS Layer (or Add WFS Layer), then New.
- Paste the GetCapabilities address from the layer’s Publishing tab.
- Under Authentication, choose Basic: your user name, and the token as the password.
- Connect and add the layer.
For WCS, QGIS and GDAL want the address without the query part.
MapLibre and deck.gl
Section titled “MapLibre and deck.gl”Use the vector tiles’ TileJSON as a vector source in MapLibre, or with deck.gl’s MVTLayer. mvt/style.json gives one MapLibre style per layer; it is a template, not a conversion of the layer’s SLD.
Send the token as a header: in MapLibre with transformRequest, in deck.gl with loadOptions.fetch.headers.
A polygon layer with height (and min_height) attributes can be drawn as 3D buildings. The vector tiles example has working pages for both.
CesiumJS
Section titled “CesiumJS”- Terrain: the elevation layer’s Quantized Mesh address with
CesiumTerrainProvider. - 3D Tiles: the tileset’s
tileset.jsonwithCesium3DTileset.fromUrl. See the 3D Tiles example; no Cesium ion account is needed. - Open in CesiumJS on Elevation, or Workspace in CesiumJS on 3D Tiles, opens the whole workspace in a CesiumJS page. Loka Server serves CesiumJS itself, so the page works offline.
loka.gl
Section titled “loka.gl”The elevation layer’s Access tab has a loka.gl code snippet: a TerrainRgbTileSource with a Bearer header. loka.gl needs a browser with WebGPU. It does not draw 3D Tiles yet.
Browser clients on another origin
Section titled “Browser clients on another origin”A web page on another address can read the services only when an administrator allows its origin. On Security, card Allowed origins (CORS):
- Add each origin as
http(s)://host[:port], without a path. At most 50. - Or tick Allow any origin (*).
Loka never sends cookies across origins, so such a page must send an API token itself.
Open services without a token
Section titled “Open services without a token”On Security, the switch Map services without token opens every read-only map service (WMS, WFS, tiles, terrain) of every workspace to everyone, with published styles only. The console and all changes still need sign-in. It is off by default, and switching it is written to the activity log.
ENC charts, elevation layers and 3D tilesets also have a Public switch each, on their Access area, for one object at a time.