1.1.50 • Published 1 month ago
lonbon-map v1.1.50
lonbon-map
安装
1.安装npm包
npm install lonbon-map -S
2. index.html添加threebox依赖
<script src="https://cdn.jsdelivr.net/gh/jscastro76/threebox@v.2.2.2/dist/threebox.min.js" type="text/javascript"></script>
<link href="https://cdn.jsdelivr.net/gh/jscastro76/threebox@v.2.2.2/dist/threebox.css" rel="stylesheet" />
使用
import { Map } from 'lonbon-map'
this.map = new Map({
is3D: this.is3D, //默认true
center: [longitude, latitude],
})
this.map.on('load', async () => {
await this.map.createBack(require("./back.png"))
this.map.createFloors({
floorId: floorId, //楼层唯一标识
maps: [{
polygons: polygons, //建筑物
scenegraphs: scenegraphs //3d模型
}],
bottom: bottom //楼层底图数据
})
})
方法
地图相关
1. 创建背景图
使用方法:this.map.createBack(image|color)
参数:
image|color 图片|颜色
2. 创建多楼层/单楼层地图
使用方法:this.map.createFloors(array|object)
参数(多楼层传array,单楼层传object):
floorId 楼层唯一标识
maps 地图信息
--polygons 建筑物geojson
--scenegraphs 3d模型geojson
--pois 兴趣点geojson(待开发)
bottom 底图geojson
3. 创建标记点
使用方法:this.map.createMarker(params)
参数:
position 地理坐标,必填
content 显示内容,必填
popup 点击显示的弹框
其它参数参考https://docs.mapbox.com/mapbox-gl-js/api/markers/#marker
4. 创建弹框
使用方法:this.map.createPopup(params)
参数:
position 地理坐标,必填
content 显示内容,必填
其它参数参考https://docs.mapbox.com/mapbox-gl-js/api/markers/#popup
5. 创建多边形
使用方法:this.map.createPolygon(params)
参数:
geometry geojson数据,必填
id 唯一标识
color 颜色
base 基础高度
height 高度
opacity 透明度
6. 切换视角
使用方法: this.map.transView()
返回值:boolean 当前视角是否为3d
7. 创建围栏
使用方法: this.map.createFence(params)
参数:
editable 是否为编辑状态
geometry geojson数据
围栏相关
1. 更改可编辑状态
使用方法: this.map.fence.changeEditable()
返回值:boolean 当前可编辑状态
2. 删除围栏
使用方法: this.map.fence.remove()
3. 销毁当前围栏对象
使用方法: this.map.fence.destroy()
4. 获取围栏geojson数据
使用方法:this.map.fence.getGeoJson()
1.1.50
1 month ago
1.1.49
2 months ago
1.1.48
2 months ago
1.1.47
4 months ago
1.1.46
4 months ago
1.1.38
6 months ago
1.1.37
6 months ago
1.1.39
5 months ago
1.1.41
5 months ago
1.1.40
5 months ago
1.1.44
5 months ago
1.1.43
5 months ago
1.1.42
5 months ago
1.1.29
7 months ago
1.1.28
7 months ago
1.1.9
8 months ago
1.1.8
8 months ago
1.1.7
8 months ago
1.1.6
8 months ago
1.1.5
8 months ago
1.1.30
6 months ago
1.1.34
6 months ago
1.1.33
6 months ago
1.1.11
7 months ago
1.1.32
6 months ago
1.1.10
8 months ago
1.1.31
6 months ago
1.1.16
7 months ago
1.1.15
7 months ago
1.1.36
6 months ago
1.1.14
7 months ago
1.1.35
6 months ago
1.1.13
7 months ago
1.1.19
7 months ago
1.1.18
7 months ago
1.1.17
7 months ago
1.1.23
7 months ago
1.1.22
7 months ago
1.1.21
7 months ago
1.1.27
7 months ago
1.1.26
7 months ago
1.1.25
7 months ago
1.1.24
7 months ago
1.1.4
8 months ago
1.1.3
8 months ago
1.1.2
8 months ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago