2019-11-19 10:21:43 +08:00
|
|
|
import { LineLayer } from '@l7/layers';
|
2019-11-16 22:22:13 +08:00
|
|
|
import { Scene } from '@l7/scene';
|
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2019-11-17 17:31:01 +08:00
|
|
|
pitch: 60,
|
2019-11-16 22:22:13 +08:00
|
|
|
type: 'mapbox',
|
|
|
|
style: 'light',
|
2019-11-20 17:26:24 +08:00
|
|
|
center: [ -74.06967, 40.720399 ],
|
|
|
|
zoom: 12.45977
|
2019-11-16 22:22:13 +08:00
|
|
|
});
|
2019-11-20 17:26:24 +08:00
|
|
|
fetch(
|
|
|
|
'https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e6a89fd950.csv'
|
|
|
|
)
|
|
|
|
.then(res => res.text())
|
|
|
|
.then(data => {
|
|
|
|
const layer = new LineLayer({})
|
|
|
|
.source(data, {
|
|
|
|
parser: {
|
|
|
|
type: 'csv',
|
|
|
|
x: 'start station longitude',
|
|
|
|
y: 'start station latitude',
|
|
|
|
x1: 'end station longitude',
|
|
|
|
y1: 'end station latitude'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.size(1)
|
|
|
|
.shape('arc3d')
|
|
|
|
.color('#0C47BF')
|
|
|
|
.style({
|
|
|
|
opacity: 1,
|
|
|
|
blur: 0.9
|
|
|
|
});
|
|
|
|
scene.addLayer(layer);
|
|
|
|
});
|