天天看點

前端導航跳轉位址

之前做過mui的導航,不過當時需要從app跳轉到導航頁面。需要将位址參數傳過去,現在有幾個官方的導航位址url

--------------------------------------------------------------------------------------------------------------------------------------------------------------

幾個地圖(高德、百度、Apple、Google)URL API

移動應用中,如何在自己的App中調起第三方的原生地圖App,并顯示相關的資訊,如顯示指定的一個坐标位置,顯示一個起點到終點的路線查詢,等等。

目前幾個主要的地圖商都提供了自己的App通過URL調用的形式,以下是本人稍微彙總了一下的内容,以備查詢。

1、高德地圖

示例(iOS):

iosamap://navi?sourceApplication=applicationName&backScheme=applicationScheme&poiname=fangheng&poiid=BGVIS&lat=36.547901&lon=104.258354&dev=1&style=2

詳細官方接口說明:

http://code.autonavi.com/uri/uriios

示例(Android):

act=android.intent.action.VIEW  

cat=android.intent.category.DEFAULT  

dat=androidamap://navi?sourceApplication=appname&poiname=fangheng&poiid=BGVIS&lat=36.547901&lon=104.258354&dev=1&style=2  

pkg=com.autonavi.minimap  

詳細官方接口說明:

http://code.autonavi.com/uri/uriandroid

2、百度地圖

示例(iOS):

baidumap://map/direction?origin=中關村&destination=五道口&mode=driving&region=北京  

 //本示例是通過該URL啟動地圖app并進入北京市從中關村到五道口的駕車導航路線圖

詳細官方接口說明:

http://developer.baidu.com/map/uri-introios.htm

示例(Android):

intent = Intent.getIntent("intent://map/line?coordtype=&zoom=&region=上海&name=28&src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");  //調起百度地圖用戶端(Android)展示上海市"28"路公共汽車的檢索結果

startActivity(intent);   //啟動調用

詳細官方接口說明:

http://developer.baidu.com/map/uri-introandroid.htm

3、Apple Map

示例(iOS):

http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino

詳細官方接口說明:

https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

4、Google Map

示例(iOS):

comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic

詳細官方接口說明:

https://developers.google.com/maps/documentation/ios/urlscheme

示例(Android):

對于Android,是通過Intent形式打開Native Map.

Intent intent=new Intent(Intent.ACTION_VIEW);  

String url = "https://maps.google.com/maps?q=31.207149,121.593086(金科路)&z=17&hl=en";  

Uri uri = Uri.parse(url);  

intent.setData(uri);  

startActivity(intent);  

詳細官方Intent接口說明:

http://developer.android.com/guide/components/intents-common.html#Maps

至于URL的參數怎麼寫,可以參考Google在iOS文檔中對參數的說明。

StackOverflow上有人很好的回答了這個問題:http://stackoverflow.com/questions/17915901/is-there-an-android-equivalent-to-google-maps-url-scheme-for-ios

高德地圖 HTTP頁面

http://developer.amap.com/api/uri-api/guide/travel/route

URL: http://uri.amap.com/navigation?from=116.478346,39.997361,startpoint&to=116.3246,39.966577,endpoint&via=116.402796,39.936915,midwaypoint&mode=car&policy=1&src=mypage&coordinate=gaode&callnative=0
           

百度地圖調用

安卓端:  http://developer.baidu.com/map/wiki/index.php?title=uri/api/android

  "baidumap://map/walknavi?origin=40.057406655722,116.2964407172&destination=39.91441,116.40405"

IOS端口:  http://developer.baidu.com/map/wiki/index.php?title=uri/api/ios

  "baidumap://map/direction?origin=34.264642646862,108.95108518068&destination=40.007623,116.360582&mode=driving&src=webapp.navi.yourCompanyName.yourAppName"

網頁端口: http://developer.baidu.com/map/wiki/index.php?title=uri/api/web

  http://api.map.baidu.com/direction?origin=latlng:34.264642646862,108.951