0

If I have a set of vector tile files that only available to max zoom at 16, how can I show it on the map at zoom 17 or even 18?

Because of the cause of the data, or the amount of the vector tiles in a layer at a zoom level , my vector tiles generating speed is slow or generated vector tiles is unavailable because it may effect the display of the other layers. That is, I may unable to generated enough vector tiles when I needed them.

My map setting:

map = new mapboxgl.Map({
                container: "gmap",
                zoom: 8,
                center: [120.685296,24.136738],
                style: {
                    "version": 8,
                    "layers": [
                        {
                            "id": "TempBaseMap",
                            "type": "background",
                            "paint": {
                                "background-color": "#C0C0C0"
                            },
                            "minzoom": 8
                        }
                    ],
                },
                maxZoom: 18,
                localIdeographFontFamily: "'Microsoft Jhenghei'",
                logoPosition: "top-left"
            });

And I want to add this vector tiles to a layer...

map.addLayer({
                    "id": "Road",
                    "source": {
"type":"vector",
"tiles":["http://(my local machine)/Road/{z}/{x}/{y}.pbf"]
},
                    "source-layer": "Road",
                    "type": "line",
                    "maxNativeZoom": 18,
                    "layout": {"visibility":"visible"},
                    "paint": {},
                    "minzoom": 8
                });

maxNativeZoom seems works with mapbox.js but I feel that it didn't work with mapbox GL JS.

  • Have you tested that the ZL 16 tiles vanish if you zoom in? Vector tiles software usually allows overzooming. – bugmenot123 Jul 9 at 8:19
  • I've tested, I saw my vector tiles at ZL 16 but vanished in ZL 17. – Gary Lu Jul 9 at 23:57
  • 1
    Can you share your code? You need to set a maxzoom on your GL JS source, and then a higher maxzoom on your GL JS layer so it overzooms. – AndrewHarvey Jul 10 at 0:55
  • Code added. And about maxzoom….I didn't have set my vector tiles' maxzoom because I want to met with my map. – Gary Lu Jul 10 at 2:28
  • "met"? If you do not enable maxzoom then the layer won't show on higher levels. – bugmenot123 Jul 10 at 8:30
0

As said by @AndrewHarvey

In you tile-source add maxzoom

"source": { "maxzoom": 16,//add this line "type":"vector", "tiles":["http://(my local machine)/Road/{z}/{x}/{y}.pbf"] }

Setting max zoom level in source will tell mapbox-gl to over zoom after that zlevel else it will query for the source at all zoom levels

-1

Normally you build vector tiles to level 14 as the max and mapping software overzooms with no loss in quality. Usually there is no value producing data at lower zoom levels even assets or utilities show fine at 14 is max zoom. Parcels and buildings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.