oslew docs
Console
Menu

MapsplatformoperationId style_json

GET/v1/style.json

A MapLibre GL style over the basemap: layers, colours and the source pointing back at this service.

Hand it to MapLibre or Mapbox GL as the style URL and a map appears. Part of the platform product.

Send Authorization: Bearer sk_live_…. The key's plan must include theplatform product; which plans do.

Explained in Vector tiles and A commute-time map.

Example

The MapLibre style.

curl
curl "https://api.oslew.com/v1/style.json" \
  -H "Authorization: Bearer $GEO_API_KEY"
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.style_json()
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.style_json();
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 290
ratelimit-reset: 1

{
  "glyphs": "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "background",
      "paint": {
        "background-color": "#f2efe9"
      },
      "type": "background"
    },
    {
      "filter": [
        "==",
        [
          "geometry-type"
        ],
        "Polygon"
      ],
      "id": "landcover",
      "paint": {
        "fill-color": [
          "match",
          [
            "get",
            "class"
          ],
          "forest",
          "#add19e",
          "tree",
          "#b5d6a7",
          "grass",
          "#cdebb0",
          "crop",
          "#eef0d5",
          "shrub",
          "#c8d7ab",
          "urban",
          "#e3dfda",
          "snow",
          "#f7fbff",
          "glacier",
          "#ddecec",
          "barren",
          "#e8dccb",
          "rock",
          "#e2ddd6",
          "sand",
          "#f5e9c6",
          "wetland",
          "#d1e6d6",
          "mangrove",
          "#b9d6c4",
          "moss",
          "#d6e3c4",
          "reef",
          "#c5e0e8",
          "physical",
          "#e2ddd6",
          "land",
          "#f2efe9",
          "crater",
          "#e2ddd6",
          "desert",
          "#f2e6c9",
          "#e6efd8"
        ],
        "fill-opacity": 0.85
      },
      "source": "basemap",
      "source-layer": "landcover",
      "type": "fill"
    },
    {
      "filter": [
        "==",
        [
          "geometry-type"
        ],
        "Polygon"
      ],
      "id": "landuse",
      "paint": {
        "fill-color": [
          "match",
          [
            "get",
            "class"
          ],
          "park",
          "#c8facc",
          "recreation",
          "#dff7df",
          "protected",
          "#d8ebc9",
          "horticulture",
          "#d6ecc6",
          "managed",
          "#d8efc8",
          "agriculture",
          "#eef0d5",
          "residential",
          "#e8e4df",
          "developed",
          "#ebe5e1",
          "education",
          "#f7efe3",
          "medical",
          "#f5e1e1",
          "military",
          "#f0d9d9",
          "religious",
          "#e7e3d8",
          "cemetery",
          "#d6e4cf",
          "transportation",
          "#e6e3e1",
          "pedestrian",
          "#efedea",
          "entertainment",
          "#f2e4f1",
          "golf",
          "#d4f0c8",
          "campground",
          "#e2f0d4",
          "construction",
          "#e4ddcf",
          "winter_sports",
          "#eef7fb",
          "aquaculture",
          "#d6e8ee",
          "resource_extraction",
          "#e4ddcf",
          "#ece8e2"
        ],
        "fill-opacity": 0.9
      },
      "source": "basemap",
      "source-layer": "landuse",
      "type": "fill"
    },
    {
      "filter": [
        "==",
        [
          "get",
          "class"
        ],
        "bathymetry"
      ],
      "id": "water-bathymetry",
      "paint": {
        "fill-color": [
          "interpolate",
          [
            "linear"
          ],
          [
            "coalesce",
            [
              "get",
              "depth"
            ],
            0
          ],
          0,
          "#aad3df",
          200,
          "#94c5d7",
          1000,
          "#7cb3cb",
          4000,
          "#5f9bbb",
          8000,
          "#4682a7"
        ]
      },
      "source": "basemap",
      "source-layer": "water",
      "type": "fill"
    }
  ],
  "name": "oslew basemap",
  "sources": {
    "basemap": {
      "attribution": "© OpenStreetMap contributors · Overture Maps Foundation",
      "type": "vector",
      "url": "http://127.0.0.1:18481/v1/tiles.json"
    }
  },
  "version": 8
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call. Shortened for the page: layers shows 4 of 29.

Responses

200 — A MapLibre GL style document.

object

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400No tile archive loaded.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.