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 ...
随机推荐
- Linux学习笔记(八)Linux常用命令:用户登录查看命令
一.查看登录用户信息 w [用户名] 二.Who who 三.查询当前登录和过去登陆的用户信息 last 四.查看所有用户最后一次登录时间 lastlog
- redis——持久化策略
4.2.2 持久 化方式(1 ) RDB 方式1. 什么是 RDB 方式?Redis Database(RDB),就是在指定的时间间隔内将内存中的数据集快照写入磁盘,数据恢复时将快照文件直接再读到内存 ...
- jade继承
代码的复用是jade非常突出的一个设计目标,jade不仅仅通过mixin来复用代码,他在文件的组织能力上也非常突出,说白了,就是继承和包涵 block定义的方式和调用的方式 block desc ...
- SQL JOB实现数据库同步
数据库同步是一种比较常用的功能.以下结合我自己的体会整理的,如果有理解不完全或者有误的地方望大牛不理赐教.下面介绍的就是数据库同步的两种方式: 1.SQL JOB的方式 sql Job的方式同步数据 ...
- 单元测试框架之unittest(三)
一.摘要 前边的文章我们看到执行测试用例的是通过调用unittest.mian()函数,它会将模块的测试用例收集起来并执行,然而当我们的测试用例增多了以后,这样的执行非常不灵活而且没有效率,我们更愿意 ...
- pyside pyqt QPushbuttion 无边框 stylesheet border:none
pyside pyqt QPushbuttion 无边框 stylesheet border:none 在 stylesheet 中添加 border:none 即可 效果是字体到边缘之间的间隙为0, ...
- [唐胡璐]Selenium技巧- Prop.Properties配置测试应用的环境和其他配置项
prop.propertiesfile contains important info that needs to be changed before the test is run, such a ...
- django中权限控制到按钮级别
权限控制到按钮级别 : 1.思路 : 由于每个按钮都能认为是一个权限,所以每个按钮都会有一个自己的路径,这些路径都在用户登录时保存在了session ...
- WeakReference 弱引用
弱引用是使用WeakReference类创建的.因为对象可能在任意时刻被回收,所以在引用该对象前必须确认它存在. class MainEntryPoint { static void Main() { ...
- C# IFormattable 接口重写
public class Racer : IComparable<Racer>, IFormattable { public int Id { get; private set; } pu ...