2019-11-14 11:50:12 +08:00
|
|
|
import { Scene } from '@l7/scene';
|
2019-11-19 10:21:43 +08:00
|
|
|
import { PointLayer } from '@l7/layers'
|
2019-11-14 11:50:12 +08:00
|
|
|
|
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
|
|
|
pitch: 35.210526315789465,
|
|
|
|
type: 'amap',
|
|
|
|
style: 'dark',
|
|
|
|
center: [108.524505, 29.873128],
|
|
|
|
zoom: 4.4,
|
|
|
|
|
|
|
|
});
|
|
|
|
window.mapScene = scene;
|
|
|
|
fetch('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json')
|
|
|
|
.then((res) => res.json())
|
|
|
|
.then((data) => {
|
|
|
|
const pointLayer =
|
2019-11-19 10:21:43 +08:00
|
|
|
new PointLayer({
|
2019-11-14 11:50:12 +08:00
|
|
|
})
|
|
|
|
.source(data.list, {
|
|
|
|
parser: {
|
|
|
|
type: 'json',
|
|
|
|
x: 'j',
|
|
|
|
y: 'w'
|
|
|
|
}
|
2019-11-19 10:21:43 +08:00
|
|
|
})
|
2019-11-14 11:50:12 +08:00
|
|
|
.shape('cylinder')
|
2019-11-19 10:21:43 +08:00
|
|
|
.size('t', function (level) {
|
2019-11-14 11:50:12 +08:00
|
|
|
return [1, 2, level * 2 + 20];
|
|
|
|
})
|
2019-11-19 10:21:43 +08:00
|
|
|
.color('t', [
|
2019-11-14 11:50:12 +08:00
|
|
|
'#094D4A', '#146968',
|
|
|
|
'#1D7F7E', '#289899',
|
|
|
|
'#34B6B7', '#4AC5AF',
|
|
|
|
'#5FD3A6', '#7BE39E',
|
|
|
|
'#A1EDB8', '#CEF8D6'
|
2019-11-19 10:21:43 +08:00
|
|
|
])
|
2019-11-14 11:50:12 +08:00
|
|
|
.style({
|
|
|
|
opacity: 1.0,
|
|
|
|
})
|
2019-11-19 10:21:43 +08:00
|
|
|
scene.addLayer(pointLayer);
|
|
|
|
console.log(pointLayer);
|
|
|
|
|
2019-11-14 11:50:12 +08:00
|
|
|
});
|