通过ISO 3166-1字母-3国家代码过滤边界平铺



是否可以通过ISO 3166-1字母-3国家代码过滤边界波浪集?如果是,那么怎么做呢?我在文档中搜索过,但没有找到任何内容。这就是我目前通过2个字符的国家/地区代码iso_3166_1过滤波浪形符集的方式。我试图将其从"iso_3166_1"更改为"iso_3166 _1_alpha_3",这是在引用不同的内容时发现的,但它不起作用。

mapBox.on('load', () => {
mapBox.addSource('admin-1', {
type: 'vector',
url: 'mapbox://mapbox.boundaries-adm1-v3'
});
var countriesToDisplay: Array<string> = ['US', 'NZ']
countriesToDisplay.forEach((countryCode: string) => {
mapBox.addLayer({
id: 'admin-1-fill-' + countryCode,
type: 'fill',
source: 'admin-1',
'source-layer': 'boundaries_admin_1',
filter: ['any', ['all', ['==', ['get', 'iso_3166_1'], countryCode]]],
paint: { 'fill-color': '#044e9c' }
}, 'waterway-label');
});
});

Mapbox Boundaries v3 tileset在实际瓦片中只有一些功能,对于多边形,它们是:

  • id
  • iso_3166_1
  • 世界观

请在此处查看完整的参考文档:https://docs.mapbox.com/vector-tiles/reference/mapbox-boundaries-v3/#polygon-tileset参考

其余数据存储在购买瓷砖集时发送的补充查找表中。您可以在此处查看所有可用属性:https://docs.mapbox.com/help/tutorials/get-started-mapbox-boundaries/#feature-查找表

您将需要执行一个数据联接,以便在javascript中访问这些查找表中的数据。这里有一个教程可以带你了解这一点:https://docs.mapbox.com/help/tutorials/data-joins-with-mapbox-boundaries/

最新更新