直接通过链接跳转即可唤起高德地图APP或者百度地图APP,示例如下:
var s = startAddressInfo;//起点地址信息
var e = endAddressInfo;//终点地址信息
if (type === 'gaode') {
location.href = `https://uri.amap.com/navigation
?from=${s.slng},${s.slat},${s.slocation}
&to=${e.lng},${e.lat},${e.location}
&mode=car&callnative=1&coordinate=wgs84&src=mypage`;
} else if (type === 'baidu') {
location.href = `http://api.map.baidu.com/mobile/direction
?origin=latlng:${s.slng},${s.slat}|name:${s.slocation}
&destination=latlng:${e.lat},${e.lng}|name:${e.location}
&origin_region=${s.scity}&destination_region=${e.city}
&mode=driving&output=html&src=webapp.baidu.openAPIdemo&coord_type=wgs84`;
}
Web版百度地图面向PC&移动端浏览器的网站应用或移动APP应用,其中PC浏览器调起的百度地图地址为:百度地图http://map.baidu.com/ ;移动端调起的百度地图地址为:百度地图
http://map.baidu.com/mobile/