• 几个地图(高德、百度、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.95108518068|name:我家&destination=大雁塔&m
  • 相关阅读:
    单表查询
    解读python中SocketServer源码
    C++实训(2.3)
    C++实训(2.2)
    C++实训(2.1)
    C++实训(1.3)
    C++实训(1.1)
    顺序表的实现,在vs2019上运行成功
    p243_5(3)
    自考新教材-p176_5(2)
  • 原文地址:https://www.cnblogs.com/xw-que/p/6728958.html
Copyright © 2020-2023  润新知