Skip to content

support PMTiles protocol#1496

Open
benstonezhang wants to merge 1 commit intonextcloud:masterfrom
benstonezhang:maplibre_gl_pmtiles
Open

support PMTiles protocol#1496
benstonezhang wants to merge 1 commit intonextcloud:masterfrom
benstonezhang:maplibre_gl_pmtiles

Conversation

@benstonezhang
Copy link
Contributor

support maps vector tiles from PMTiles file: url starts with string "pmtiles://"

below is a sample style file:

{
  "version": 8,
  "sources": {
    "example_maps": {
      "type": "vector",
      "url": "pmtiles://https://example.com/maps/pmtiles/region.pmtiles"
    }
  },
  "sprite": "/maps/style/protomaps_v4_light",
  "glyphs": "/maps/fonts/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "bg",
      "type": "background",
      "paint": {
        "background-color": "#F2EFE9"
      }
    },
    {
      "id": "ocean",
      "type": "fill",
      "source": "example_maps",
      "source-layer": "ocean",
      "paint": {
        "fill-color": "#AAD3DF"
      }
    },
    {
      "id": "water_polygons",
      "type": "fill",
      "source": "example_maps",
      "source-layer": "water_polygons",
      "paint": {
        "fill-color": "#AAD3DF"
      }
    },
    {
      "id": "boundaries",
      "type": "line",
      "source": "example_maps",
      "source-layer": "boundaries",
      "paint": {
        "line-color": "#8D618B"
      }
    },
    {
      "id": "streets",
      "type": "line",
      "source": "example_maps",
      "source-layer": "streets",
      "layout": {
        "visibility": "visible"
      },
      "paint": {
        "line-color": [
          "match",
          [
            "get",
            "kind"
          ],
          "motorway",
          "#e66e89",
          [
            "trunk",
            "primary",
            "secondary"
          ],
          "#f4c37d",
          "#ccccca"
        ]
      }
    },
    {
      "id": "places",
      "type": "symbol",
      "source": "example_maps",
      "source-layer": "place_labels",
      "layout": {
        "text-field": [
          "get",
          "name"
        ],
        "text-font": [
          "Open Sans Semibold"
        ],
        "text-size": 16
      },
      "paint": {
        "text-halo-width": 1,
        "text-halo-color": "rgba(255, 255, 255, 1)"
      }
    },
    {
      "id": "buildings",
      "type": "fill",
      "source": "example_maps",
      "source-layer": "buildings",
      "paint": {
        "fill-color": "#D9D0C9"
      }
    }
  ],
  "id": "example_maps-demo-maplibre"
}

Signed-off-by: Benstone Zhang <benstonezhang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant