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

参考文档 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
        },

你可能感兴趣的:(高德地图-经纬度-点位标注图片-静态地图)