Mapbox 中村庄的可见性
Visibility of villages in Mapbox
在我的 Mapbox GL 项目中,我有一个包含城镇和村庄的图层,如下所示:
{
"id": "towns",
"type": "symbol",
"source": "composite",
"source-layer": "place_label",
"minzoom": 1,
"maxzoom": 14,
"filter": [
"all",
[
"match",
["get", "type"],
["town", "village", "hamlet"],
true,
false
],
["match", ["get", "name"], [
// list of villages
], true, false]
],
"layout": {
"text-variable-anchor": ["top", "bottom", "left", "right"],
"text-allow-overlap": true,
"text-ignore-placement": true,
"icon-allow-overlap": true,
"text-field": ["get", "name"],
"text-font": ["Roboto Regular", "Arial Unicode MS Regular"],
"text-size": [
"interpolate",
["linear"],
["zoom"],
3,
8,
22,
16
]
},
"paint": {
"text-halo-color": "hsla(0, 0%, 100%, 0.95)",
"text-halo-width": 1,
"text-halo-blur": 0.4
}
},
文本大小的缩放插值适用于城镇。但是,村庄只会在缩放级别为 9 后显示。有什么办法可以让村庄始终可见?
最有可能的是,您使用的 Mapbox Streets Tileset 仅包含缩放 9 后数据中的那些村庄,因此您无法在样式中做任何事情来使其更早显示。
您需要创建自己的数据集,其中包含您想要的较低缩放级别的数据(也许首先在 Mapbox Studio 数据视图中检查这是不是原因)。
在我的 Mapbox GL 项目中,我有一个包含城镇和村庄的图层,如下所示:
{
"id": "towns",
"type": "symbol",
"source": "composite",
"source-layer": "place_label",
"minzoom": 1,
"maxzoom": 14,
"filter": [
"all",
[
"match",
["get", "type"],
["town", "village", "hamlet"],
true,
false
],
["match", ["get", "name"], [
// list of villages
], true, false]
],
"layout": {
"text-variable-anchor": ["top", "bottom", "left", "right"],
"text-allow-overlap": true,
"text-ignore-placement": true,
"icon-allow-overlap": true,
"text-field": ["get", "name"],
"text-font": ["Roboto Regular", "Arial Unicode MS Regular"],
"text-size": [
"interpolate",
["linear"],
["zoom"],
3,
8,
22,
16
]
},
"paint": {
"text-halo-color": "hsla(0, 0%, 100%, 0.95)",
"text-halo-width": 1,
"text-halo-blur": 0.4
}
},
文本大小的缩放插值适用于城镇。但是,村庄只会在缩放级别为 9 后显示。有什么办法可以让村庄始终可见?
最有可能的是,您使用的 Mapbox Streets Tileset 仅包含缩放 9 后数据中的那些村庄,因此您无法在样式中做任何事情来使其更早显示。
您需要创建自己的数据集,其中包含您想要的较低缩放级别的数据(也许首先在 Mapbox Studio 数据视图中检查这是不是原因)。