antv-l7/examples/line/isoline/demo/ele.js

40 lines
857 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, LineLayer } from '@antv/l7';
2019-11-14 23:32:45 +08:00
const scene = new Scene({
id: 'map',
2019-11-20 17:26:24 +08:00
pitch: 53.6305,
2019-11-14 23:32:45 +08:00
type: 'amap',
style: 'light',
2019-11-20 17:26:24 +08:00
center: [ 102.600579, 23.114887 ],
zoom: 14.66
2019-11-14 23:32:45 +08:00
});
fetch('https://gw.alipayobjects.com/os/rmsportal/ZVfOvhVCzwBkISNsuKCc.json')
2019-11-20 17:26:24 +08:00
.then(res => res.json())
.then(data => {
const layer = new LineLayer({})
.source(data)
.size('ELEV', h => {
return [ h % 50 === 0 ? 1.0 : 0.5, (h - 1300) * 20 ];
2019-11-14 23:32:45 +08:00
})
2019-11-20 17:26:24 +08:00
.shape('line')
.scale('ELEV', {
type: 'quantize'
})
.color(
'ELEV',
[
'#E4682F',
'#FF8752',
'#FFA783',
'#FFBEA8',
'#FFDCD6',
'#EEF3FF',
'#C8D7F5',
'#A5C1FC',
'#7FA7F9',
'#5F8AE5'
].reverse()
);
2019-11-14 23:32:45 +08:00
scene.addLayer(layer);
});