Skip to content

Instantly share code, notes, and snippets.

@ttomasz
Last active May 29, 2022 00:35
Show Gist options
  • Save ttomasz/a18bc988154ce00f7863c644a0720302 to your computer and use it in GitHub Desktop.
Save ttomasz/a18bc988154ce00f7863c644a0720302 to your computer and use it in GitHub Desktop.
Basic map style with OSM Carto tiles

Starter style for libraries using Mapbox style language like: Mapbox GL JS and Maplibre GL JS.

Wrote it down for myself when I want to set up a map for non-commercial OpenStreetMap-related purposes and don't want to use commercially available vector tiles.

It contains just OSM raster tiles (make sure usage won't be against tiles usage policy).

It can be loaded into visual editor such as Mapbox Studio or Maputnik.

{
"version": 8,
"name": "Map style",
"metadata": {"maputnik:renderer": "mbgljs"},
"sources": {
"osm": {
"type": "raster",
"tiles": [
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
],
"tileSize": 256,
"minzoom": 0,
"maxzoom": 19,
"attribution": "© <a target=\"_blank\" rel=\"noopener\" href=\"https://openstreetmap.org/copyright\">OpenStreetMap contributors</a>"
}
},
"sprite": "",
"glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "raster",
"source": "osm",
"layout": {"visibility": "visible"}
}
],
"id": "style"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment