antv-l7/examples/point/column/demo/clumn_shape.js

44 lines
947 B
JavaScript
Raw Normal View History

2019-11-21 17:52:18 +08:00
import { Scene, PointLayer } from '@antv/l7';
import { AMap } from '@antv/l7-maps';
2019-11-14 11:50:12 +08:00
const scene = new Scene({
id: 'map',
map: new AMap({
pitch: 66.02383,
style: 'dark',
center: [ 121.400257, 31.25287 ],
zoom: 14.55,
rotation: 134.9507
2019-11-26 19:17:39 +08:00
})
2019-11-14 11:50:12 +08:00
});
2019-11-20 17:26:24 +08:00
fetch(
'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json'
)
.then(res => res.json())
.then(data => {
const pointLayer = new PointLayer({})
.source(data, {
parser: {
type: 'json',
x: 'longitude',
y: 'latitude'
}
})
.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-20 17:26:24 +08:00
.color('name', [ '#739DFF', '#61FCBF', '#FFDE74', '#FF896F' ])
.style({
opacity: 1.0
});
2019-11-14 11:50:12 +08:00
scene.addLayer(pointLayer);
2019-11-14 11:50:12 +08:00
});