Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Vector tiles may not be displayed in Mapbox GL JS

We have added vector tiles to the map drawn with Mapbox GL JS. We changed the tiles of addSource based on the sample below, and it shows what we expected. https://docs.mapbox.com/mapbox-gl-js/example/third-party/

        const source = "xxx"

        map.addSource(source, {
          type: "vector",
          tiles: [`http://tiles.url/{z}/{x}/{y}.mvt`],
          minzoom: 7,
          maxzoom: 17,
        });

        const sourceLayer = "yyy";
        const layerId = "zzz";

        map.addLayer(
        {
            id: layerId,
            type: "fill",
            source,
            "source-layer": sourceLayer,
            paint: {
              "fill-color": "#ff0000",
            },
          },
          "road-label"
        );

        map.setPaintProperty(layerId, "fill-opacity", 0.6);
        map.setPaintProperty(layerId, "fill-antialias", false);

We added a button there, and we made it so that when the button is pressed, it switches to another source and layer, which is also working as we expected.

        const layerId = "zzz";
        map.removeLayer(layerId);

        const source = "xxx"
        map.removeSource(source);

However, when we try the same thing after manipulating the zoom with NavigationControl, the tiles do not show up. How can we solve this trouble?

We have set the maxZoom and minZoom of our maps and sources appropriately. At this zoom the tiles should be visible.

After this problem is encountered, when we manipulate the zoom level, the tiles will reappear. However, if we just manipulate the zoom level from the program, the tiles will not appear.

We also tried adding all the sources and layers and changing the visibility to visible or none to switch, but the same problem occurs.

map.setLayoutProperty(
  layerId,
  'visibility',
  isShow ? 'visible' : 'none'
)

Do you have any advice or tips for us?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!