2019-11-21 13:06:13 +08:00
|
|
|
|
---
|
|
|
|
|
title: PointLayer
|
2019-12-14 22:15:28 +08:00
|
|
|
|
order: 0
|
2019-11-21 13:06:13 +08:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 简介
|
2019-12-02 15:16:45 +08:00
|
|
|
|
|
|
|
|
|
点数据的展示,数据源支持 JSON,GeoJSON,CSV 三种数据格式。
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
|
|
shape 支持
|
|
|
|
|
|
2019-12-02 15:16:45 +08:00
|
|
|
|
**3D 类型 柱图**
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
'cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn'
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**2D 符号图**
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
'circle', 'square', 'hexagon', 'triangle', 'pentagon', 'octogon', 'hexagram','rhombus', 'vesica',
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
2020-03-12 16:06:26 +08:00
|
|
|
|
## source
|
|
|
|
|
|
|
|
|
|
点数据类型,根据经纬点绘制图形,目前支持三种数据结构
|
|
|
|
|
|
|
|
|
|
- [GeoJSON]('../../../../source/geojson/#point')
|
|
|
|
|
- [CSV](../../../../source/csv/#parser)
|
|
|
|
|
- [JSON](../../../../source/json/#点数据)
|
|
|
|
|
|
2019-11-21 13:06:13 +08:00
|
|
|
|
**图片标注**
|
|
|
|
|
|
2019-12-02 15:16:45 +08:00
|
|
|
|
通过 `Scene.addImage()` 可以添加图片资源,
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
|
|
### 代码示例
|
|
|
|
|
|
|
|
|
|
#### 基本图形显示示例
|
|
|
|
|
|
|
|
|
|
```javascript
|
2019-12-02 15:16:45 +08:00
|
|
|
|
import { PointLayer } from '@antv/l7';
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
|
|
const layer = PointLayer({
|
2019-12-02 15:16:45 +08:00
|
|
|
|
zIndex: 2,
|
|
|
|
|
})
|
|
|
|
|
.source(data.list, {
|
|
|
|
|
type: 'array',
|
|
|
|
|
x: 'j',
|
|
|
|
|
y: 'w',
|
|
|
|
|
})
|
|
|
|
|
.shape('cylinder')
|
|
|
|
|
.size('t', (level) => {
|
|
|
|
|
return [4, 4, level + 40];
|
|
|
|
|
})
|
|
|
|
|
.color('t', [
|
|
|
|
|
'#002466',
|
|
|
|
|
'#105CB3',
|
|
|
|
|
'#2894E0',
|
|
|
|
|
'#CFF6FF',
|
|
|
|
|
'#FFF5B8',
|
|
|
|
|
'#FFAB5C',
|
|
|
|
|
'#F27049',
|
|
|
|
|
'#730D1C',
|
|
|
|
|
]);
|
2019-11-21 13:06:13 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### 符号图
|
|
|
|
|
|
|
|
|
|
使用图片添加地图标注
|
|
|
|
|
|
|
|
|
|
```javascript
|
2019-12-02 15:16:45 +08:00
|
|
|
|
scene.addImage(
|
|
|
|
|
'local',
|
|
|
|
|
'https://gw.alipayobjects.com/zos/rmsportal/xZXhTxbglnuTmZEwqQrE.png',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const layer = new PointLayer({
|
|
|
|
|
zIndex: 4,
|
|
|
|
|
})
|
|
|
|
|
.source(city)
|
|
|
|
|
.size(20.0)
|
|
|
|
|
.shape('local')
|
|
|
|
|
.color('#0D408C');
|
2019-11-21 13:06:13 +08:00
|
|
|
|
```
|