MapBox 中使用windLayer
ValarMorghulis12138 opened this issue · comments
John Snow commented
大佬您好,请问mapbox添加windLayer是怎么使用呢,没有具体的说明,是否为windLayer.onAdd(mapbox.Map)?
import { WindLayer } from '@sakitam-gis/mapbox-wind';
const windLayer = new WindLayer('wind-map', data, {
windOptions: {
// colorScale: scale,
velocityScale: 1 / 20,
paths: 5000,
// eslint-disable-next-line no-unused-vars
colorScale: [
'rgb(36,104, 180)',
'rgb(60,157, 194)',
'rgb(128,205,193 )',
'rgb(151,218,168 )',
'rgb(198,231,181)',
'rgb(238,247,217)',
'rgb(255,238,159)',
'rgb(252,217,125)',
'rgb(255,182,100)',
'rgb(252,150,75)',
'rgb(250,112,52)',
'rgb(245,64,32)',
'rgb(237,45,28)',
'rgb(220,24,32)',
'rgb(180,0,35)',
],
width: 3,
// colorScale: scale,
generateParticleOption: false,
},
//map: this.map,
// projection: 'EPSG:4326'
});
windLayer.onAdd(this.map);
John Snow commented
这样添加后,一直报“mapbox-wind.esm.js?a3e6:1110 Uncaught TypeError: bounds.contains is not a function”错误
sakitam-fdd commented
@ValarMorghulis12138
WindLayer 使用 windLayer.addTo(map)
ScalarFill 使用 map.addLayer(fillLayer)
参见:https://github.com/sakitam-fdd/wind-layer/blob/master/examples/mapbox-wind.html