Skip to content
oslew
Get a free key

APIs

Vector tiles and static maps API

A vector tiles API serves map data in small square pieces that a client library such as MapLibre draws on the device. oslew serves one basemap, built from open data, as Mapbox Vector Tiles or as PNG pictures of them, with a TileJSON document and a ready MapLibre style to point a map at, and renders static PNG maps for emails and documents. The basemap’s licence is ODbL, by its attribution: © OpenStreetMap contributors · Overture Maps Foundation, so that attribution has to appear wherever the map does.

Last reviewed

A basemap is a large, slowly changing dataset that every map view reads a small part of. oslew packs it into one archive of tiles — Overture’s base layers, transportation, buildings, divisions and addresses, with places and transit stops — and serves that archive through four routes. Which one you use depends on whether the thing displaying the map can render vectors, and whether it can run a map at all.

Tiles and the two documents that describe them

GET /v1/tiles/{z}/{x}/{y} returns one tile in the XYZ scheme, with the format chosen by an extension on y: .mvt or .pbf for the vector tile, or .png for a picture of it. Vector tiles are sent exactly as stored, gzipped, whatever the client asked for; browsers and fetch unpack them transparently, while a command-line download keeps the compressed bytes. A tile outside the archive, or deeper than its maximum zoom, answers 204 with no body. The service does not overzoom vectors; MapLibre does that itself from the deepest stored level.

GET /v1/tiles.json is the TileJSON document: the tile URL template, zoom range, bounds, attribution and a vector_layers list naming every layer and its fields. The layer names follow the vocabulary OpenMapTiles-style maps use — water, landcover, transportation, building, boundary, place, poi, housenumber and the rest — so an existing style of that family is a starting point rather than a rewrite. The tile URL inside it is built from the host the request arrived on, which matters as soon as a proxy sits in between.

GET /v1/style.json is a MapLibre style that draws the whole basemap: one vector source pointing at the TileJSON, and its layers in the same colours the PNG renderer uses, so a raster fallback matches the vector map. It has no sprite sheet, so icons are yours to add.

Where the label fonts come from

The style is the one place the map reaches beyond oslew. The MapLibre style at /v1/style.json points its glyphs at MapLibre’s public demo font server, demotiles.maplibre.org, and that URL is fixed in code; a map client drawing labels fetches fonts from there unless the style is rewritten. The font server needs no key and serves nothing but glyphs, but it is a demonstration service run by another project. A production map that should not depend on it can host the glyph files on its own origin and replace the glyphs entry when it loads the style. In a network with no route to the internet this is required rather than optional, and the air-gapped deployment page lists it among the changes such a deployment needs.

The raster side has no such dependency. PNG tiles and static maps are drawn by the server itself and carry no text, so they need no font server.

The key stays on your server

A key is read only from the Authorization header; a key in the query string is ignored, including on the compatibility routes. The service sends no CORS headers, so a page on another origin cannot call it from a browser. Together those rule out calling the tile routes from a web page, and MapLibre’s transformRequest hook is not a way round them: it would put the key in the browser, and the browser would still refuse the cross-origin reply. A key shipped inside a mobile app is no safer, because anyone can extract it.

The working pattern is a small proxy at your own origin that does three things. It forwards only the style, the TileJSON and tile paths, because a proxy that forwards anything publishes your key’s whole plan. It adds the Authorization header. And it rewrites the single URL inside each JSON document so MapLibre fetches everything from your origin. Tiles pass through untouched, still compressed, with their cache lifetime. The vector tiles guide has the proxy in TypeScript and Python.

Every tile is a request against the key’s Platform rate, and one person panning a map requests dozens. Tiles change only when the basemap is rebuilt and are marked public and cacheable for a day, so a CDN or your web server’s cache in front of the proxy turns many viewers’ requests into one fetch per tile.

Static maps

GET /v1/static?at=lat,lon&zoom=…&width=…&height=… returns a PNG of the basemap centred on a point, stitched from the tiles under the view. Width and height are each held between 64 px and 2,048 px. Zoom numbers follow MapLibre’s tile size, so services that count smaller tiles, such as Leaflet or Google’s static maps, show the same scale at a zoom one higher. A fractional zoom is rounded, so send whole numbers.

What the image leaves out is as important as what it draws:

  • No labels. No street, place or district names appear.
  • No markers or overlays. There are no parameters for them; project your points with Web Mercator from the same centre and zoom, and draw them on top.
  • No attribution. The image is bare, so the caption, email text or page footer has to carry it.
  • Background where there is no data. A centre outside the archive answers 200 with a plain picture, not an error, so check the point against the TileJSON bounds if an empty image would be a bug.

An <img> tag cannot fetch the API directly, for the same key reasons as tiles. Fetch the PNG on your server, keep it, and serve your own copy: the image for a given centre, zoom and size does not change until the basemap is rebuilt, so a shop that sends a thousand confirmations showing the same map needs one request, not one per email.

Attribution and share-alike

The basemap derives from OpenStreetMap through Overture Maps, and its licence is ODbL, by its attribution: © OpenStreetMap contributors · Overture Maps Foundation. On a vector map the attribution is on the style’s source and MapLibre shows it in the corner by default; leave the control on. On PNG tiles and static images, print it beside the picture. A rendered map is a produced work, which calls for attribution; a database you extract from the tiles and publish would carry share-alike terms. The licensing page covers the difference, and results from the geocoding API may be drawn on this map or any other.

What it costs

Tiles, TileJSON, style and static maps are all in the Platform product: $699 a month for 20 requests a second sustained, burst 100, or 100 requests a second sustained, burst 300 on Scale. There is no charge per map load and no monthly quota; the constraint is the sustained rate, which is why a cache in front of the proxy is part of any public map. Going faster than the plan returns HTTP 429 with Retry-After, which a proxy passes on and MapLibre shows as missing tiles.

Limits worth knowing

  • The map covers the area the archive was built for, stated in the TileJSON’s bounds; beyond it, vector tiles answer 204 and images show background.
  • Vector tiles stop at the archive’s maximum zoom, and images are magnified only a few zooms beyond it before the scale stops changing.
  • Labels need fonts from the demo server or your own host, and there are no sprites.
  • There is no satellite or aerial imagery layer, no traffic layer and no route drawing; overlays are the client’s job.
  • Nothing here is callable from a browser without a proxy, and none of it is exposed as an MCP tool, because files are not answers an agent reasons over.

Bottom line

For an interactive map, serve the style, TileJSON and tiles through a same-origin proxy with a cache in front, and decide early whether to host the label fonts. For email and print, fetch static PNGs once, store them, and print the attribution next to them. If your map shows administrative lines, the boundaries API answers which of those areas a point falls in.

Questions

Can I use oslew tiles with MapLibre GL JS or Leaflet?

MapLibre is the intended client: point it at the style from /v1/style.json, served through your own backend, and it reads the TileJSON, overzooms the deepest tiles itself and shows the attribution. Leaflet can show the PNG tiles, but it has to be told they are larger than its default tile size, or everything appears at half scale one zoom off.

Can a web page call the tile endpoint directly?

No. The key goes only in an Authorization header, it must never reach a browser, and the service sends no CORS headers, so a page on another origin is refused before it reads anything. A small proxy on your backend that forwards only the map paths, adds the header and rewrites the URLs in the two JSON documents is the pattern that works.

Why are there no street names on a static map?

The service draws shapes, not text. PNG tiles and static maps carry land cover, water, roads, rail and buildings in the style’s colours, but no labels, markers or attribution. Names exist only in the vector tiles, where a client renders them with fonts, so draw anything else you need on top of the image yourself.

Does the map depend on any outside service?

One thing: the MapLibre style names MapLibre’s public demo font server for label glyphs, and that URL is fixed in code. A client drawing labels fetches fonts from there unless you host the glyph files yourself and rewrite the style’s glyphs URL. PNG tiles and static maps need no fonts at all.

What attribution must I show with the map?

The basemap is derived from OpenStreetMap through Overture Maps and is under the ODbL. The style and the TileJSON carry the attribution, and MapLibre’s attribution control shows it if you leave it switched on. PNG tiles and static maps carry none, so print the attribution line beside them wherever they appear.

Browse every page →