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',
|
2019-11-16 22:22:13 +08:00
|
|
|
pitch: 65.68421052631578,
|
2019-11-17 17:31:01 +08:00
|
|
|
type: 'mapbox',
|
2019-11-14 11:50:12 +08:00
|
|
|
style: 'light',
|
2019-11-19 10:21:43 +08:00
|
|
|
center: [121.3917, 31.259242],
|
|
|
|
zoom: 13.55,
|
2019-11-16 22:22:13 +08:00
|
|
|
rotation: 120
|
2019-11-14 11:50:12 +08:00
|
|
|
|
|
|
|
});
|
2019-11-16 22:22:13 +08:00
|
|
|
window.mapScene = scene;
|
2019-11-14 11:50:12 +08:00
|
|
|
|
|
|
|
fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.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, {
|
|
|
|
parser: {
|
|
|
|
type: 'json',
|
|
|
|
x: 'longitude',
|
|
|
|
y: 'latitude'
|
|
|
|
}
|
2019-11-19 10:21:43 +08:00
|
|
|
}).shape('name', ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn'])
|
|
|
|
.size('unit_price', (h) => {
|
|
|
|
return [6, 6, h / 500]
|
2019-11-14 11:50:12 +08:00
|
|
|
})
|
2019-11-19 10:21:43 +08:00
|
|
|
.color('name', ['#5B8FF9', "#70E3B5", '#FFD458', '#FF7C6A'])
|
2019-11-14 11:50:12 +08:00
|
|
|
.style({
|
|
|
|
opacity: 1.0,
|
|
|
|
})
|
|
|
|
|
2019-11-19 10:21:43 +08:00
|
|
|
scene.addLayer(pointLayer);
|
2019-11-14 11:50:12 +08:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|