odoo 集成微信地图
如果启动获取用户位置:可以在用户进入系统时候,获取用户地址。
3:如果不启动全局参数,只有在使用获取地址方法的界面显示获取地理位置信息(如果当允许:此情况下只是当前页面可获取,下次进入该页面再次提醒,如果不允许无法获取位置,此处允许不影响公众号的地址位置)
type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
var locations = res.longitude + "," + res.latitude; //微信位置
$.getJSON("amap/convert?location=" + locations, //将微信地址转为正确的地址,由于GV地址位置有偏差
var tolocations = result.locations;//实际地址
actual_longitude = tolocations.split(",")[0];
actual_latitude = tolocations.split(",")[1];
formatted_address = result.formatted_address;
return [actual_longitude, actual_latitude,formatted_address]
function openLocation(latitude,longitude,name,infoUrl) {
latitude : Number(latitude), // 纬度,浮点数,范围为90 ~ -90
longitude : Number(longitude), // 经度,浮点数,范围为180 ~ -180。
scale : 14, // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl :infoUrl // 在查看位置界面底部显示的超链接,可点击跳转