高德地图-经纬度-点位标注图片-静态地图

内容分享2个月前发布
3 0 0

参考文档 https://lbs.amap.com/api/webservice/guide/api/staticmaps/

需求是, 通过经纬度坐标, 返回一个地图的标注图, 最后展示的是一个图片.

高德地图-经纬度-点位标注图片-静态地图

openGisDialog (record) {
            this.gisImgVisible = true;
            let gisImg = {
                mainKey:  gisUrl ,
                key: 你的key , // 
                location:`${record.longitude},${record.latitude}`,
                zoom: 15 ,
                size: 600*400 ,
                scale:  2 ,
                markers:`-1,${record.modelImg},:${record.longitude},${record.latitude}`,
                gisUrl:  http://restapi.amap.com/v3/staticmap? ,
            }
            this.gisTitle = `${record.waterMode}[${record.waterSection}]`
            this.gisImgUrl = this.getGisImgUrl(gisImg)
        },
        getGisImgUrl (obj) {
            let url =   
            let params = []
            for (let key in obj) {
                if (key === obj.mainKey) {
                    url = obj[key]
                } else if (key !==  mainKey ) {
                    params.push(`${key}=${obj[key]}`)
                }
            }
            url += params.join( & )
            return url
        },

© 版权声明

相关文章

暂无评论

none
暂无评论...