iOS 地图 通过经纬度计算两点间距离
- (double)calculateStart:(CLLocationCoordinate2D)start end:(CLLocationCoordinate2D)end {
double meter = ;
double startLongitude = start.longitude;
double startLatitude = start.latitude;
double endLongitude = end.longitude;
double endLatitude = end.latitude;
double radLatitude1 = startLatitude * M_PI / 180.0;
double radLatitude2 = endLatitude * M_PI / 180.0;
double a = fabs(radLatitude1 - radLatitude2);
double b = fabs(startLongitude * M_PI / 180.0 - endLongitude * M_PI / 180.0);
double s = * asin(sqrt(pow(sin(a/),) + cos(radLatitude1) * cos(radLatitude2) * pow(sin(b/),)));
s = s * EARTH_RADIUS;
meter = round(s * ) / ; //返回距离单位是米
return meter;
}
//赤道半径EARTH_RADIUS = 6378137;//start 起点经纬度,数据格式 start = {lon:,lat:}//end 终点定位度,数据格式 end = {lon:,lat:}iOS 地图 通过经纬度计算两点间距离的更多相关文章
- [MSSQL2008]Spatial Data in SQL Server 2008 - 根据经纬度计算两点间距离
DECLARE @BJ GEOGRAPHY DECLARE @XT GEOGRAPHY /* GET Latitude/Longitude FROM here:http://www.trave ...
- sql server 根据经纬度计算两点间距离
DECLARE @BJ GEOGRAPHY DECLARE @XT GEOGRAPHY SELECT @BJ= geography::Point('39.92889', '116.38833', 43 ...
- Java-根据经纬度计算距离(百度地图距离)
最近碰到一个需求,需要根据两个点的经纬度查询两点的距离.感觉以后还会用到,所以小记一波. 第一步:添加Maven依赖. <dependency> <groupId>org.ga ...
- iOS根据2个经纬度计算距离
#pragma mark - calculate distance 根据2个经纬度计算距离 #define PI 3.14159265358979323 +(double) CalculationDi ...
- IOS根据两个经纬度计算相距距离
//第一种苹果自带的 CLLocation *orig=[[[CLLocation alloc] initWithLatitude:[mainDelegate.latitude_self double ...
- js根据经纬度计算两点距离
js版-胡老师 google.maps.LatLng.prototype.distanceFrom = function(latlng) { var lat = [this.lat(), lat ...
- 如何在iOS地图上高效的显示大量数据
2016-01-13 / 23:02:13 刚才在微信上看到这篇由cocoachina翻译小组成员翻译的文章,觉得还是挺值得参考的,因此转载至此,原文请移步:http://robots.thought ...
- 利用JS实现的根据经纬度计算地球上两点之间的距离
最近用到了根据经纬度计算地球表面两点间距离的公式,然后就用JS实现了一下. 计算地球表面两点间的距离大概有两种办法. 第一种是默认地球是一个光滑的球面,然后计算任意两点间的距离,这个距离叫做大圆距 ...
- YTU 2619: B 友元类-计算两点间距离
2619: B 友元类-计算两点间距离 时间限制: 1 Sec 内存限制: 128 MB 提交: 469 解决: 252 题目描述 类Distance定义为类Point的友元类来实现计算两点之间距 ...
随机推荐
- CSS之Flex 布局:语法篇
网页布局(layout)是 CSS 的一个重点应用. 布局的传统解决方案,基于盒状模型,依赖 display 属性 + position属性 + float属性.它对于那些特殊布局非常不方便,比如 ...
- Mysql EXPLAIN 相关疑问: Using temporary ; Using filesort
一.什么是Using temporary ; Using filesort 1. using filesort filesort主要用于查询数据结果集的排序操作,首先MySQL会使用sort_buff ...
- mysql 删除表
删除表 DROP TABLE 表名;
- python模块之pyMySql
目录: 安装 使用 一.安装 本模块为python第三方模块,需要单独安装.作用为调用mysql接口执行模块 pip3 install pyMySql 二.使用 1.执行SQL #!/usr/bin/ ...
- python学习笔记(二十八)日志模块
我们在写程序的时候经常会打一些日志来帮助我们查找问题,这次学习一下logging模块,在python里面如何操作日志.介绍一下logging模块,logging模块就是python里面用来操作日志的模 ...
- 3.7 Templates -- Links
一.The {{link-to}} Helper 1. 使用{{link-to}}创建一个指向route的链接: app/router.js Router.map(function() { this. ...
- (2)基本工作流(制作场景与UI)
1.认识cocos编辑器主界面. 2.制作新场景: 1)打开我们新建的HelloCocos项目,新建场景名称为“Scene”,如下图: 2)点击新建,场景就被创建出来了,如下图: 3) ...
- Educational Codeforces Round 47
A. Game Shopping 签. #include <bits/stdc++.h> using namespace std; #define N 1010 int n, m, c[N ...
- poj1981 Circle and Points
地址:http://poj.org/problem?id=1981 题目: Circle and Points Time Limit: 5000MS Memory Limit: 30000K To ...
- 20135320赵瀚青LINUX第七周学习笔记
赵瀚青原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 概述 本周学习的内容主要是讨 ...