设为首页 加入收藏

TOP

C#的百度地图开发(三)依据坐标获取位置、商圈及周边信息(三)
2019-09-03 01:38:35 】 浏览:77
Tags:百度 地图 开发 依据 坐标 获取 位置 商圈 周边 信息
nbsp; }  
  •             catch (Exception e)  
  •             {  
  •                 info = "定位异常:" + e.Message;  
  •                 return null;  
  •             }  
  •   
  •             return locationResult;  
  •         }  
  • }  
  • 注:

     

    (1).使用const常量来定义一个百度地图API的URL模板,方便后面的调用。

    (2).TransToBaiduCoord函数是《C#的百度地图开发(二)转换JSON数据为相应的类》中将非百度坐标转换成百度坐标方法的封装。

    (3).RequestUrl方法是《C#的百度地图开发(一)发起HTTP请求》所说的发起HTTP请求的封装。

    (4).CoordLocationResult类的具体实现,请参看后面的代码。

     

    [html]  view plaincopy在CODE上查看代码片派生到我的代码片
    1. namespace MapApi.Baidu  
    2. {  
    3.   
    4.     [Serializable]  
    5.     public class CoordLocationResult  
    6.     {  
    7.         /// <summary>  
    8.         /// 状态  
    9.         /// </summary>  
    10.         public String status { get; set; }  
    11.   
    12.         /// <summary>  
    13.         /// 结果  
    14.         /// </summary>  
    15.         public CoordLocationResult_Result result { get; set; }  
    16.     }  
    17.   
    18.     #region CoordLocationResult_Result  
    19.     /// <summary>  
    20.     /// 定位结果  
    21.     /// </summary>  
    22.     [Serializable]  
    23.     public class CoordLocationResult_Result  
    24.     {  
    25.         /// <summary>  
    26.         /// 定位的经度与纬度  
    27.         /// </summary>  
    28.         public CoordLocationResult_Result_Location location { get; set; }  
    29.   
    30.       
    首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/8/8
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    上一篇ASP.NET菜鸟之路之Request小例子 下一篇从客户端中检测到有潜在危险的Req..

    最新文章

    热门文章

    Hot 文章

    Python

    C 语言

    C++基础

    大数据基础

    linux编程基础

    C/C++面试题目