gpt4 book ai didi

javascript - Mapbox GL JS : Layering Roads/Cities over Overlay

转载 作者:行者123 更新时间:2023-12-03 01:36:45 25 4
gpt4 key购买 nike

如何在不使用帐户中的 map 编辑器的情况下将道路和标签放置在图像叠加层上?我正在使用非自定义 map ,只需要图像上的标签(下面的示例)。我的源代码和覆盖层的示例代码 enter image description here是:

topleftmapbox.on('load', function() {
topleftmapbox.addSource("source_KEWX_REFLECTIVITY_SWEEP0_13", {
"type": "image",
"url": "images/KEWX_Z_SWEEP0_13.gif",
"coordinates": [

[-98.3868664444, 30.062422],
[-97.6698002222,30.062422],
[-97.6698002222, 29.3453557778],
[-98.3868664444, 29.3453557778]
]
})


topleftmapbox.addLayer({
"id": "overlay_KEWX_REFLECTIVITY_SWEEP0_13",
"source": "source_KEWX_REFLECTIVITY_SWEEP0_13",
"type": "raster",
"layout": {"visibility": "none"},
"paint": {
"raster-opacity": 0.99,

}
})
});

最佳答案

addlayer 有一个可选参数,名为 before ,描述为:

要在之前插入新图层的现有图层的 ID。如果省略此参数,图层将附加到图层数组的末尾。

请引用API https://www.mapbox.com/mapbox-gl-js/api/#map#addlayer

使用示例

https://www.mapbox.com/mapbox-gl-js/example/geojson-layer-in-stack/

关于javascript - Mapbox GL JS : Layering Roads/Cities over Overlay,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51040494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com