zoukankan      html  css  js  c++  java
  • 调用系统路线导航

    想参考米途订酒店客户端来做酒店地图那一块,调用系统的地图来标示出导航路线;
    于是找了下例子,
    NSString *theString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=Current Location&daddr=%f,%f",Location.latitude, Location.longitude];
        theString =  [theString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
       
        NSURL *url = [[NSURL alloc] initWithString:theString];
        [[UIApplication sharedApplication] openURL:url];
    这段代码就是调用自带的googlemap,模拟器显示的是webView,真机显示才会是调用系统的东西;


    NSString *urlString = [[NSString alloc]
         initWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirfl=d",
            curLocation.latitude,
            curLocation.longitude,
            stationLocation.latitude,
            stationLocation.longitude];

    NSURL *aURL = [NSURL URLWithString:urlString];
    [urlString release];
    [[UIApplication sharedApplication] openURL:aURL];

    调用这个貌似也一样,但是比前面那个网址多了个&dirfl=d,没什么区别,我也是网上看到的别人写的,不知道这里的不同会不会有什么区别,目前从效果上是没看到任何区别的;


     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",loc.latitude,loc.longitude,中国山东济南市某某街某某号]]];
    出发地选用的参数为经纬度,可以通过手机gps获得(具体实现在下篇),目的地可以是位置名称,也可以是经纬度(没用过)。http://blog.sina.com.cn/s/blog_68eb52b3010141pe.html

    目的地可以是位置名称,不一定是经纬度;

    刚开始用这个 http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f  原来这个是不可用的;
    参考 http://www.cnblogs.com/zhulin/archive/2012/11/09/2761926.html


    另外 画线路图有个什么overlay的东西;没仔细研究过

  • 相关阅读:
    [bzoj4241] 历史研究 (分块)
    [tyvj2054] 四叶草魔杖 (最小生成树 状压dp)
    20180710 考试记录
    [luogu2047 NOI2007] 社交网络 (floyed最短路)
    [luogu2081 NOI2012] 迷失游乐园 (树形期望dp 基环树)
    [luogu1600 noip2016] 天天爱跑步 (树上差分)
    [luogu2216 HAOI2007] 理想的正方形 (2dST表 or 单调队列)
    [poj 3539] Elevator (同余类bfs)
    [BZOJ1999] 树网的核 [数据加强版] (树的直径)
    bzoj2301 [HAOI2011]Problem b
  • 原文地址:https://www.cnblogs.com/neworiginou/p/2860617.html
Copyright © 2011-2022 走看看