L7
L7 copied to clipboard
麻烦请教一下,我这个线图老是没显示结果,是否哪里配置有误?
最近用Vue3, vite, 加L7试了地图功能,想画个线条,老是出不来,麻烦专家帮忙诊断下,这是代码:
const scene = new Scene({
id: 'map',
map: new GaodeMap({
pitch: 0,
style: 'normal',
center: shgMapStyle.initPos,
zoom: shgMapStyle.initZoom,
token: gaode_key,
}),
logoVisible: false,
});
scene.on('loaded', () => {
let lineData = {
type: "FeatureCollection",
features: [
{
type: "Feature",
properties: {},
geometry: {
type: "LineString",
coordinates: [
[118.83, 32.06],
[118.93, 31.56],
[119.53, 30.00],
]
}
}
]
};
const lineLayer = new LineLayer()
.source(lineData, {
zIndex: 2000,
autoFit: true,
blend: 'additive',
})
.shape('line')
.size(2)
.color('#f00')
.animate(false)
.active(true)
.style({
strokeWidth: 1,
arrow: {
enable: true,
arrowWidth: 2,
arrowHeight: 3,
tailWidth: 1,
},
})
;
scene.addLayer(lineLayer);
});
看下你的地图中心点,是不是里那个线条的经纬度比较远,试了下,可以画出来