antv-l7/docs/tutorial/quickstart.zh.md

83 lines
1.2 KiB
Markdown
Raw Normal View History

2019-11-21 13:06:13 +08:00
---
title: 快速上手
order: 0
redirect_from:
- /zh/docs/tutorial
---
# L7
2019-11-21 23:27:01 +08:00
Current version: 2.0.0-beta.10
2019-11-21 13:06:13 +08:00
## 使用方法
2019-11-21 13:06:13 +08:00
### 通过 L7 CDN 使用
Include the L7 JS JavaScript <head> of your HTML file.
2019-11-21 13:06:13 +08:00
```html
<head>
2019-11-29 01:14:31 +08:00
<script src='https://gw.alipayobjects.com/os/antv/pkg/_antv.l7-2.0.0-beta.14/dist/l7.js'>
</script>
2019-11-21 13:06:13 +08:00
</head>
```
2019-11-28 23:38:18 +08:00
- [use Gaode Map](./map/amap)
2019-11-21 13:06:13 +08:00
2019-11-28 23:38:18 +08:00
- [use Mapbox Map ](./map/mapbox)
2019-11-21 13:06:13 +08:00
## 通过 Module bundle 使用
2019-11-21 13:06:13 +08:00
Install the npm package.
2019-11-21 13:06:13 +08:00
```bash
2019-11-21 13:06:13 +08:00
2019-11-28 17:49:04 +08:00
// L7 依赖
npm install --save @antv/l7@beta
2019-11-21 13:06:13 +08:00
2019-11-28 17:49:04 +08:00
// 第三方底图依赖
npm install --save @antv/l7-maps;
2019-11-21 13:06:13 +08:00
```
2019-11-28 17:49:04 +08:00
### 初始化地图
2019-11-28 23:38:18 +08:00
#### 使用 高德 底图
2019-11-28 17:49:04 +08:00
```javascript
import { Scene, PointLayer } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
pitch: 35.210526315789465,
style: 'dark',
center: [ 104.288144, 31.239692 ],
zoom: 4.4
})
});
```
#### 使用Mapbox 底图
```javascript
import { Scene, HeatmapLayer } from '@antv/l7';
import { Mapbox } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new Mapbox({
style: 'dark',
pitch: 0,
center: [ 127.5671666579043, 7.445038892195569 ],
zoom: 2.632456779444394
})
});
```