2019-11-21 13:06:13 +08:00
|
|
|
---
|
2019-12-02 15:45:08 +08:00
|
|
|
title: QuickStart
|
2019-11-21 13:06:13 +08:00
|
|
|
order: 0
|
|
|
|
redirect_from:
|
2019-11-26 11:59:39 +08:00
|
|
|
- /en/docs/tutorial
|
2019-11-21 13:06:13 +08:00
|
|
|
---
|
2020-11-21 03:51:18 +08:00
|
|
|
`markdown:docs/tutorial/quickstart.zh.md`
|
2019-11-28 13:37:42 +08:00
|
|
|
## L7
|
|
|
|
|
2020-03-14 12:31:09 +08:00
|
|
|
Current version: ![L7 2.0版本号](https://badgen.net/npm/v/@antv/l7)
|
2019-11-28 13:37:42 +08:00
|
|
|
|
2019-11-21 13:06:13 +08:00
|
|
|
# 使用方法
|
|
|
|
|
2019-11-28 17:49:04 +08:00
|
|
|
|
|
|
|
## 通过L7 CDN 使用
|
2019-11-21 13:06:13 +08:00
|
|
|
|
2019-11-28 13:37:42 +08:00
|
|
|
Include the L7 JS JavaScript <head> of your HTML file.
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
```html
|
|
|
|
<head>
|
2020-01-31 11:41:49 +08:00
|
|
|
<script src='https://unpkg.com/@antv/l7'>
|
2019-11-28 13:37:42 +08:00
|
|
|
</script>
|
2019-11-21 13:06:13 +08:00
|
|
|
</head>
|
|
|
|
```
|
|
|
|
|
2019-11-28 13:37:42 +08:00
|
|
|
- [use Gaode Map](../map/amap.en.md)
|
|
|
|
|
|
|
|
- [use Mapbox Map ](../map/mapbox.en.md)
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
|
2019-11-28 13:37:42 +08:00
|
|
|
## 通过 Module bundle 使用
|
|
|
|
|
|
|
|
Install the npm package.
|
2019-11-21 13:06:13 +08:00
|
|
|
|
|
|
|
```bash
|
2019-11-21 23:27:01 +08:00
|
|
|
|
2019-11-28 17:49:04 +08:00
|
|
|
// L7 依赖
|
2019-11-25 11:47:02 +08:00
|
|
|
npm install --save @antv/l7@beta
|
|
|
|
|
2019-11-28 17:49:04 +08:00
|
|
|
// 第三方底图依赖
|
|
|
|
npm install --save @antv/l7-maps;
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
### 初始化地图
|
|
|
|
|
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';
|
2019-11-21 23:27:01 +08:00
|
|
|
|
2019-11-28 17:49:04 +08:00
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
|
|
|
map: new GaodeMap({
|
|
|
|
pitch: 35.210526315789465,
|
2021-02-20 22:18:58 +08:00
|
|
|
mapStyle: 'dark',
|
2019-11-28 17:49:04 +08:00
|
|
|
center: [ 104.288144, 31.239692 ],
|
|
|
|
zoom: 4.4
|
|
|
|
})
|
|
|
|
});
|
2019-11-21 13:06:13 +08:00
|
|
|
```
|
2019-11-28 17:49:04 +08:00
|
|
|
|
|
|
|
#### 使用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
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
```
|
|
|
|
|