赞
踩
获取需要手绘地图左下角和右上角GPS坐标
以北京故宫为例:
由于地图素材文件比较大,小程序又限制包大小<=2M,无法存放本地,所以素材只能存放云端
- this._mapContext = uni.createMapContext("map", this);//map为map组件id
-
- this._mapContext.addGroundOverlay({
- id: 11,
- src: `xxx.png`,//手绘地图素材路径
- bounds: {
- southwest: {//左下角GPS
- longitude: southwest[1],
- latitude: southwest[0]
- },
- northeast: {//右上角GPS
- longitude: northeast[1],
- latitude: northeast[0]
- }
- },
- visiable: true,
- zIndex: 1000,
- success: () => {
- console.log("显示成功", southwest, northeast)
- },
- fail: (e) => {
- console.log("显示失败", e)
- }
- })
采用大分辨率素材,并将素材裁剪成M*N个瓦片,通过拼接的方式对手绘地图进行拼接
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。