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

移動應用中,如何在本身的App中調起第三方的原生地圖App,並顯示相關的信息,如顯示指定的一個座標位置,顯示一個起點到終點的路線查詢,等等。php

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

 

一、高德地圖android

示例(iOS):ios

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

詳細官方接口說明:api

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

 

示例(Android):webapp

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  ide

詳細官方接口說明:ui

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

 

 

二、百度地圖

示例(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

 

三、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

 

四、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.95108518068|name:我家&destination=大雁塔&m
相關文章
相關標籤/搜索