antv-l7/examples/line/arc/demo/trip_arc.js

38 lines
849 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, LineLayer } from '@antv/l7';
import { Mapbox } from '@antv/l7-maps';
2019-11-16 22:22:13 +08:00
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 60,
type: 'mapbox',
style: 'light',
2019-12-02 15:16:45 +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(
2019-12-02 15:16:45 +08:00
'https://gw.alipayobjects.com/os/basement_prod/bd33a685-a17e-4686-bc79-b0e6a89fd950.csv',
2019-11-20 17:26:24 +08:00
)
2019-12-02 15:16:45 +08:00
.then((res) => res.text())
.then((data) => {
2019-11-20 17:26:24 +08:00
const layer = new LineLayer({})
.source(data, {
parser: {
type: 'csv',
x: 'start station longitude',
y: 'start station latitude',
x1: 'end station longitude',
2019-12-02 15:16:45 +08:00
y1: 'end station latitude',
},
2019-11-20 17:26:24 +08:00
})
.size(1)
.shape('arc3d')
.color('#0C47BF')
.style({
opacity: 1,
2019-12-02 15:16:45 +08:00
blur: 0.9,
2019-11-20 17:26:24 +08:00
});
scene.addLayer(layer);
});