Public maps on your own domain
Render published OrbGIS layers on your website with MapLibre GL JS. Public tiles and feature reads work across domains without an API key.
Add a layer#
Publish the content
Publish a dashboard, Journey or web map that uses the layer. Its dataset page shows which apps expose it. See Sharing and publishing.
Add a vector source
Set the MapLibre source’s url to
https://api.orbgis.se/v1/collections/{id}/tiles.json. TileJSON supplies the tile template, bounds and zoom range.Style the layer
Set
"source-layer": "default"on the MapLibre layer and provide your own basemap and style. TileJSON contains data, not the portal’s symbology.Load popup details
Use the clicked feature’s id to fetch
/v1/collections/{id}/items/{objectid}. Published layers allow this without a credential.
Keep API keys out of web pages. A key sent with an Origin header returns 403 key_in_browser; use published content for anonymous websites.
Refresh and caching#
- Re-fetch TileJSON to pick up new versioned tile URLs after a data change. Anonymous API responses are cached for 60 seconds.
- Unpublishing can take about five minutes to close anonymous tile access because of tile caches.
- MapLibre uses Web Mercator tiles. Clients with projected views can use native systems listed in
orbgis.nativeGrids. - Anonymous API requests are limited to 120 per minute per network. Keep popup reads to one request per click.
A complete MapLibre example page is available from OrbGIS on request.