Published
Edited
Mar 20, 2020
3 stars
Insert cell
md`# L7 Line Layer`
Insert cell
L7 = require('@antv/l7')
Insert cell
data = fetch("https://gw.alipayobjects.com/os/basement_prod/ee07641d-5490-4768-9826-25862e8019e1.json")
.then(response => response.json())
Insert cell
map = {
const container = html`<div style="height: 500px;">`;
yield container; // Give the container dimensions.

const scene = new L7.Scene({
id: container,
map: new L7.Mapbox({
style: 'dark',
center: [ 103.83735604457024, 1.360253881403068 ],
pitch: 4.00000000000001,
zoom: 10.210275860702593,
rotation: 19.313180925794313
})
});

scene.on("loaded", () => {
const layer = new L7.LineLayer({})
.source(data, {
parser: {
coordinates: 'path',
type: 'json'
}
})
.size('level', level => {
return [ 1.0, level * 1 ];
})
.shape('line')
.color(
'level',
[
'#312B60',
'#4A457E',
'#615C99',
'#816CAD',
'#A67FB5',
'#C997C7',
'#DEB8D4',
'#F5D4E6',
'#FAE4F1',
'#FFF3FC'
].slice(0, 8)
);
scene.addLayer(layer);
});

}

Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more