Skip to content

The 20250217.pmtiles didn't contain any countries names and borders, and any cities at all #385

Closed

Description

@raphael10-collab

Hi!

Yesterday I downloaded these PMTiles: https://build.protomaps.com/20250217.pmtiles and the world map didn't contain any countries names and borders, and any cities at all

Today I downloaded these PMTiles: https://build.protomaps.com/20240902.pmtiles
and the map does contain countries names and borders, and cities

Image

This is the index.html I'm using:

<html>
    <head>
        <title>PMTiles MapLibre Example</title>
        <meta charset="utf-8"/>
        <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css" crossorigin="anonymous">
        <script src="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
        <script src="https://unpkg.com/pmtiles@3.0.6/dist/pmtiles.js"></script>
        <style>
            body {
                margin: 0;
            }
            #map {
                height:100%; width:100%;
            }
        </style>
    </head>
    <body>
        <div id="map"></div>
        <script type="text/javascript">
            // add the PMTiles plugin to the maplibregl global.
            let protocol = new pmtiles.Protocol();
            maplibregl.addProtocol("pmtiles", protocol.tile);

            let PMTILES_URL = "protomaps.pmtiles";

            let source = new pmtiles.FetchSource(PMTILES_URL, new Headers({'Content-Language': 'xx'}));

            const p = new pmtiles.PMTiles(source);

            // this is so we share one instance across the JS code and the map renderer
            protocol.add(p);

            p.getMetadata().then((m) => {
              document.getElementById("description").textContent = m.description;
            })


            // we first fetch the header so we can get the center lon, lat of the map.
            p.getHeader().then((h) => {
              const map = new maplibregl.Map({
                container: "map",
                zoom: h.maxZoom - 2,
                center: [h.centerLon, h.centerLat],
                style: {
                  version: 8,
                  sources: {
                    example_source: {
                      type: "vector",
                      // For standard Z/X/Y tile APIs or Z/X/Y URLs served from go-pmtiles, replace "url" with "tiles" and remove all the pmtiles-related client code.
                      // tiles: ["https://example.com/{z}/[x}/{y}.mvt"],
                      // see https://maplibre.org/maplibre-style-spec/sources/#vector
                      url: "pmtiles://" + PMTILES_URL,
                      attribution:
                        '© <a href="https://openstreetmap.org">OpenStreetMap</a>',
                    },
                  },
                  layers: [
                    {
                      id: "water",
                      source: "example_source",
                      "source-layer": "water",
                      filter: ["==",["geometry-type"],"Polygon"],
                      type: "fill",
                      paint: {
                        "fill-color": "#80b1d3",
                      },
                    },
                    {
                      id: "buildings",
                      source: "example_source",
                      "source-layer": "buildings",
                      type: "fill",
                      paint: {
                        "fill-color": "#d9d9d9",
                      },
                    },
                    {
                      id: "roads",
                      source: "example_source",
                      "source-layer": "roads",
                      type: "line",
                      paint: {
                        "line-color": "#fc8d62",
                      },
                    },
                    {
                      id: "pois",
                      source: "example_source",
                      "source-layer": "pois",
                      type: "circle",
                      paint: {
                        "circle-color": "#ffffb3",
                      },
                    },
                  ],
                },
              });
              map.showTileBoundaries = true;
            });

            // we first fetch the header so we can get the center lon, lat of the map.
            p.getHeader().then(h => {
                const map = new maplibregl.Map({
                    container: 'map',
                    zoom: h.maxZoom-2,
                    center: [h.centerLon, h.centerLat],
                    style: 'style.json'
                });
            })
        </script>
    </body

Why ?

Activity

  1. wipfli commented on Feb 20, 2025

    @wipfli
    SponsorCollaborator

    Probably because the style changed in v4.

    Go to https://maps.protomaps.com/#flavorName=light&lang=en&map=0.88/0/0 and click "get style json"

    Image

  2. wipfli commented on Feb 20, 2025

    @wipfli
    SponsorCollaborator

    You see here the country names and borders are there and you can choose the display language:

    Image

  3. transferred this issue fromprotomaps/PMTileson Feb 21, 2025
  4. bdon commented on Feb 21, 2025

    @bdon
    Member

    I added a compatible NPM versions column to https://maps.protomaps.com/builds/ to make this clearer. Any other suggestions?

  5. raphael10-collab commented on Feb 25, 2025

    @raphael10-collab
    Author

    If I understand correctly the versions of compatible npm are 4 and 5 : https://maps.protomaps.com/builds/

    My npm version is 10.9.2 :

    root@WorldMap:~# npm version
    {
      npm: '10.9.2',
      node: '22.14.0',
      acorn: '8.14.0',
      ada: '2.9.2',
      amaro: '0.3.0',
      ares: '1.34.4',
      brotli: '1.1.0',
      cjs_module_lexer: '1.4.1',
      cldr: '46.0',
      icu: '76.1',
      llhttp: '9.2.1',
      modules: '127',
      napi: '10',
      nbytes: '0.1.1',
      ncrypto: '0.0.1',
      nghttp2: '1.64.0',
      nghttp3: '1.6.0',
      ngtcp2: '1.10.0',
      openssl: '3.0.15+quic',
      simdjson: '3.10.1',
      simdutf: '6.0.3',
      sqlite: '3.47.2',
      tz: '2024b',
      undici: '6.21.1',
      unicode: '16.0',
      uv: '1.49.2',
      uvwasi: '0.0.21',
      v8: '12.4.254.21-node.22',
      zlib: '1.3.0.1-motley-82a5fec'
    }
    

    Does it mean it does not work? I do hope I'm wrong...

  6. wipfli commented on Feb 25, 2025

    @wipfli
    SponsorCollaborator

    Can you create a jsbin or stackblitz or similar with the problem you are facing? The above code snippet could be a starting point...

  7. raphael10-collab commented on Feb 25, 2025

    @raphael10-collab
    Author

    May I keep summing everything up here, instead of duplicating information elsewhere?

    The issue is the following:

    I'm using this index.html https://gist.github.com/wipfli/7062a865c89e36fa74b0701289c3c6c8#file-index-html
    to which I added <link rel="stylesheet" href="style.json">

    /srv/worldmap/html/index.html :

    <html>
        <head>
            <title>PMTiles MapLibre Example</title>
            <meta charset="utf-8"/>
            <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css" crossorigin="anonymous">
            <link rel="stylesheet" href="style.json">
            <script src="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
            <script src="https://unpkg.com/pmtiles@3.0.6/dist/pmtiles.js"></script>
            <style>
                body {
                    margin: 0;
                }
                #map {
                    height:100%; width:100%;
                }
            </style>
        </head>
        <body>
            <div id="map"></div>
            <script type="text/javascript">
                // add the PMTiles plugin to the maplibregl global.
                let protocol = new pmtiles.Protocol();
                maplibregl.addProtocol("pmtiles", protocol.tile);
    
                let PMTILES_URL = "protomaps.pmtiles";
    
                const p = new pmtiles.PMTiles(PMTILES_URL);
    
                // this is so we share one instance across the JS code and the map renderer
                protocol.add(p);
    
                // we first fetch the header so we can get the center lon, lat of the map.
                p.getHeader().then(h => {
                    const map = new maplibregl.Map({
                        container: 'map',
                        zoom: h.maxZoom-2,
                        center: [h.centerLon, h.centerLat],
                        style: 'style.json'
                    });
                })
            </script>
        </body>
    </html>
    

    and these are the versions of npm and node:

    root@WorldMap:/srv/worldmap/html# npm version
    {
      npm: '10.9.2',
      node: '22.14.0',
      acorn: '8.14.0',
      ada: '2.9.2',
      amaro: '0.3.0',
      ares: '1.34.4',
      brotli: '1.1.0',
      cjs_module_lexer: '1.4.1',
      cldr: '46.0',
      icu: '76.1',
      llhttp: '9.2.1',
      modules: '127',
      napi: '10',
      nbytes: '0.1.1',
      ncrypto: '0.0.1',
      nghttp2: '1.64.0',
      nghttp3: '1.6.0',
      ngtcp2: '1.10.0',
      openssl: '3.0.15+quic',
      simdjson: '3.10.1',
      simdutf: '6.0.3',
      sqlite: '3.47.2',
      tz: '2024b',
      undici: '6.21.1',
      unicode: '16.0',
      uv: '1.49.2',
      uvwasi: '0.0.21',
      v8: '12.4.254.21-node.22',
      zlib: '1.3.0.1-motley-82a5fec'
    }
    

    OS: Ubuntu 24.04

    With this version of pmtiles : 20240902.pmtiles.0 : https://build.protomaps.com/20240902.pmtiles
    everything is fine:

    Image

    If I download the latest version: 20250224.pmtiles : https://build.protomaps.com/20250224.pmtiles

    root@WorldMap:/srv/worldmap/html# rm protomaps.pmtiles
    
    
    root@WorldMap:/srv/worldmap/html# axel https://build.protomaps.com/20250224.pmtiles
    Initializing download: https://build.protomaps.com/20250224.pmtiles
    File size: 124.115 Gigabyte(s) (133266938191 bytes)
    Opening output file 20250224.pmtiles
    Starting download
    
        [  0%] [0                                          1                                          .2                                          3                                           ] [ 997.0B/s] [1547d 1[  0%] [0                                          1                                          .2                                          3                                           ] [   1.9KB/s] [773d12
    [100%] [..............................................................................................................................................................................] [  36.4MB/s] [00:00]
    
    
    
    root@WorldMap:/srv/worldmap/html# ls -lah
    total 125G
    drwxr-xr-x  3 root root 4.0K Feb 25 16:45 .
    drwxr-xr-x  3 root root 4.0K Feb 24 12:20 ..
    -rw-r--r--  1 root root 125G Feb 25 16:45 20250224.pmtiles
    
    
    root@WorldMap:/srv/worldmap/html# mv 20250224.pmtiles protomaps.pmtiles
    root@WorldMap:/srv/worldmap/html# 
    

    I removed the previous style.json file, which was taken from here :
    https://gist.github.com/wipfli/7062a865c89e36fa74b0701289c3c6c8 ,
    and I've put the content of style.json from: https://maps.protomaps.com/#flavorName=light&lang=en&map=0.88/0/0

    Image

    But, as you can see, I get no countries names, no borders, and no cities at all :

    Image

    @wipfli
    Do I have to modify something in this index.html file?

  8. bdon commented on Feb 26, 2025

    @bdon
    Member

    My npm version is 10.9.2

    The versions 4,5 refer to the versions of the @protomaps/basemaps package on npm.

    If you are using the style.json copied from the Get Style JSON on https://maps.protomaps.com/ it should be compatible with the latest download. You haven't pasted your entire code example where you load style.json.

    This is not valid code:

    <link rel="stylesheet" href="style.json">
    

    The MapLibre style JSON is not a CSS stylesheet, it needs to be loaded in JavaScript.

  9. raphael10-collab commented on Feb 26, 2025

    @raphael10-collab
    Author

    @bdon

    This time I copied the whole style.json :

    Image

    root@WorldMap:/srv/worldmap/html# tail style.json 
                "paint": {
                    "text-color": "#a3a3a3",
                    "text-halo-color": "#e2dfda",
                    "text-halo-width": 1
                }
            }
        ],
        "sprite": "https://protomaps.github.io/basemaps-assets/sprites/v4/light",
        "glyphs": "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf"
    }
    root@WorldMap:/srv/worldmap/html# 
    

    and, with this index.html : https://gist.github.com/wipfli/7062a865c89e36fa74b0701289c3c6c8#file-index-html :

    <html>
        <head>
            <title>PMTiles MapLibre Example</title>
            <meta charset="utf-8"/>
            <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css" crossorigin="anonymous">
            <script src="https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
            <script src="https://unpkg.com/pmtiles@3.0.6/dist/pmtiles.js"></script>
            <style>
                body {
                    margin: 0;
                }
                #map {
                    height:100%; width:100%;
                }
            </style>
        </head>
        <body>
            <div id="map"></div>
            <script type="text/javascript">
                // add the PMTiles plugin to the maplibregl global.
                let protocol = new pmtiles.Protocol();
                maplibregl.addProtocol("pmtiles", protocol.tile);
    
                let PMTILES_URL = "protomaps.pmtiles";
    
                const p = new pmtiles.PMTiles(PMTILES_URL);
    
                // this is so we share one instance across the JS code and the map renderer
                protocol.add(p);
    
                // we first fetch the header so we can get the center lon, lat of the map.
                p.getHeader().then(h => {
                    const map = new maplibregl.Map({
                        container: 'map',
                        zoom: h.maxZoom-2,
                        center: [h.centerLon, h.centerLat],
                        style: 'style.json'             // <---------  in this way it should be loaded in JavaScript 
                    });
                })
            </script>
        </body>
    </html>
    

    I get a grey rendering (no maps at all) :

    Image

    If I use this style.json : https://gist.github.com/wipfli/7062a865c89e36fa74b0701289c3c6c8#file-style-json
    the world map appears but without borders, countries names and cities :

    Image

  10. bdon commented on Feb 26, 2025

    @bdon
    Member

    Did you look at what console errors appear when you get the grey screen?

  11. locked and limited conversation to collaborators on Feb 26, 2025
  12. converted this issue into a discussion #401 on Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions