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

84 lines
1.2 KiB
Markdown
Raw Normal View History

2019-11-21 13:06:13 +08:00
---
2019-11-25 11:47:02 +08:00
title: 快速上手
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
---
2019-11-25 11:47:02 +08:00
## L7
Current version: 2.0.0-beta.10
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
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>
```
- [use Gaode Map](../map/amap.en.md)
- [use Mapbox Map ](../map/mapbox.en.md)
2019-11-21 13:06:13 +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,
style: 'dark',
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
})
});
```