2021-10-13 16:51:20 +08:00
|
|
|
|
---
|
|
|
|
|
title: 点图层
|
|
|
|
|
order: 3
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
`markdown:docs/common/style.md`
|
|
|
|
|
|
|
|
|
|
## 简介
|
2021-10-14 10:41:51 +08:00
|
|
|
|
|
2021-10-14 10:40:11 +08:00
|
|
|
|
用户在地球模式下使用点图层无需做额外的操作,L7 会自动识别地球模式并相关的转化
|
2021-10-13 16:51:20 +08:00
|
|
|
|
|
|
|
|
|
## 使用
|
|
|
|
|
|
|
|
|
|
```javascript
|
2021-10-14 10:40:11 +08:00
|
|
|
|
// 1、构建 pointlayer
|
|
|
|
|
const pointlayer = new PointLayer()
|
|
|
|
|
.source(
|
|
|
|
|
data,
|
|
|
|
|
{
|
|
|
|
|
parser: {
|
|
|
|
|
type: 'json',
|
|
|
|
|
x: 'lng',
|
|
|
|
|
y: 'lat',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
// .shape('circle') // cylinder
|
|
|
|
|
.color('#f00')
|
|
|
|
|
.size(20) // .size('', () => [1, 1, 10])
|
2021-10-14 10:41:51 +08:00
|
|
|
|
|
2021-10-13 16:51:20 +08:00
|
|
|
|
...
|
|
|
|
|
|
2021-10-14 10:40:11 +08:00
|
|
|
|
// 2、添加 pointlayer 图层对象
|
|
|
|
|
scene.addLayer(pointlayer);
|
2021-10-13 16:51:20 +08:00
|
|
|
|
|
|
|
|
|
```
|