Google Directions API 中路线编码解析
public List<Location> GetGeoPoints(string encoded)
{
List<Location> poly = new List<Location>();
int index = , len = encoded.Length;
int lat = , lng = ;
while (index < len)
{
int b, shift = , result = ;
do
{
b = encoded.ToCharArray()[index++] - ;
result |= (b & 0x1f) << shift;
shift += ;
} while (b >= 0x20);
int dlat = ((result & ) != ? ~(result >> ) : (result >> ));
lat += dlat; shift = ;
result = ;
do
{
b = encoded.ToCharArray()[index++] - ;
result |= (b & 0x1f) << shift;
shift += ;
} while (b >= 0x20);
int dlng = ((result & ) != ? ~(result >> ) : (result >> ));
lng += dlng; double latResult = ((double)lat / 1E5) * 1E6 * Math.Pow(, -);
double lngResult = ((double)lng / 1E5) * 1E6 * Math.Pow(, -);
Location p = new Location(latResult, lngResult);
poly.Add(p);
}
return poly;
}
Google Directions API 中路线编码解析的更多相关文章
- HTTP1.1中CHUNKED编码解析(转载)
HTTP1.1中CHUNKED编码解析 一般HTTP通信时,会使用Content-Length头信息性来通知用户代理(通常意义上是浏览器)服务器发送的文档内容长度,该头信息定义于HTTP1.0协议RF ...
- HTTP1.1中CHUNKED编码解析
一般HTTP通信时,会使用Content-Length头信息性来通知用户代理(通常意义上是浏览器)服务器发送的文档内容长度,该头信息定义于HTTP1.0协议RFC 1945 10.4章节中.浏览器 ...
- Java Web中的编码解析
在springmvc工程web.xml中配置中文编码 <!-- 配置请求过滤器,编码格式设为UTF-8,避免中文乱码--> <filter> <filter-name&g ...
- Google Map API v2 (四)----- 导航路径
仍然是建议个异步小任务 private GetPathTask mGetPathTask = null; private void getGuidePath(LatLng origin){ if(mG ...
- Google 地图 API V3 使用入门
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- Google Maps API V3 之 图层
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- Google Map API 应用实例说明
目录 Google Map API 1基础知识 1.1 Google 地图 API 概念 1.2 Google 地图的"Hello, World" 1.2.1 加载 Google ...
- Google 地图 API V3 之事件
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- Google 地图 API V3 之控件
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
随机推荐
- HCIP DAY2
OSPF协议的基本特点: 支持无类域间路由(CIDR) vlsm NA 无路由自环 收敛速度快 使用IP组播放收发协议数据 支持多条等值路由 静态路由 动态路由 等价路由 浮动路由 支持协议报文的认证 ...
- C# 截图不失真
Bitmap bmp = new Bitmap(@"E:\2222.jpg"); Bitmap bmp2 = bmp.Clone(new Rectangle(10 + 80, 15 ...
- C# 委托实现冒泡排序
委托实现员工根据工资升序排列 首先定义员工类 class Employee { public string Name { get; private set; } public decimal Sala ...
- C# 操作文件夹、文件
Form namespace FileProperties { public partial class Form1 : Form { private string currentFolderPath ...
- 时间戳、String、Date转换
时间戳(String or long) =>Date long s=1557230621043L; Date date=new Date(s); System.out.println(date) ...
- P3648 [APIO2014]序列分割 斜率优化
题解:斜率优化\(DP\) 提交:\(2\)次(特意没开\(long\ long\),然后就死了) 题解: 好的先把自己的式子推了出来: 朴素: 定义\(f[i][j]\)表示前\(i\)个数进行\( ...
- 017_STM32程序移植之_AS608指纹模块
STM32程序移植之AS608指纹模块 BUG说明: 硬件接线图如图所示 STM32引脚 指纹模块引脚 功能 3.3V 3.3V PA3 Tx PA2 Rx GND GND PA1 WAK 3.3V ...
- [Qt Quick] No rule to make target 问题解决办法
[问题描述] 修改项目中资源的qml文件名或删除无用资源文件后,重新构建项目时,会出现类似如下的问题提示: No rule to make target 'aaa', needed by 'bbb'. ...
- nginx初步学习
今天想学习了解下nginx,找找视频,感觉不适合新手,然后来看阮一峰老师的博客 nginx容器教程:http://www.ruanyifeng.com/blog/2018/02/nginx-docke ...
- oc Learning Blog
http://www.cnblogs.com/heyonggang/p/3351269.html M了个J :http://www.cnblogs.com/mjios/tag/objective-c/ ...