/**
*
* @param longitude 经度
* @param latitude 纬度
* @param distance 范围(米)
* @return
*/
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distance) {
Map<String, double[]> squareMap = new HashMap<String, double[]>();
// 计算经度弧度,从弧度转换为角度
double dLongitude = 2 * (Math.asin(Math.sin(distance
/ (2 * 6378137))
/ Math.cos(Math.toRadians(latitude))));
dLongitude = Math.toDegrees(dLongitude);
// 计算纬度角度
double dLatitude = distance / 6378137;
dLatitude = Math.toDegrees(dLatitude);
// 正方形
double[] leftTopPoint = { latitude + dLatitude, longitude - dLongitude };
double[] rightTopPoint = { latitude + dLatitude, longitude + dLongitude };
double[] leftBottomPoint = { latitude - dLatitude,
longitude - dLongitude };
double[] rightBottomPoint = { latitude - dLatitude,
longitude + dLongitude };
squareMap.put("leftTopPoint", leftTopPoint);
squareMap.put("rightTopPoint", rightTopPoint);
squareMap.put("leftBottomPoint", leftBottomPoint);
squareMap.put("rightBottomPoint", rightBottomPoint);
System.out.println("leftTop:"+leftTopPoint[0]+"======"+leftTopPoint[1]);
System.out.println("rightTop:"+rightTopPoint[0]+"======"+rightTopPoint[1]);
System.out.println("leftBottom:"+leftBottomPoint[0]+"======"+leftBottomPoint[1]);
System.out.println("rightBottom:"+rightBottomPoint[0]+"======"+rightBottomPoint[1]);
return squareMap;
}

JAVA 根据经纬度算出附近的正方形的四个角的经纬度的更多相关文章

  1. [转]JAVA 根据经纬度算出附近的正方形的四个角的经纬度

    csv文件转化为geojson文件中,涉及到路测图的打点生成,打点是由一个个正方形组成,而正方形是由四个点组成的,这四个点根据经纬度和范围生成,具体的实现代码是从网上找来的: /** * * @par ...

  2. Java程序设计之算出一年第多少天

    可以直接拷贝运行. package year; import java.util.Scanner; public class year { public static void main(String ...

  3. Java根据年份算出所属的生肖。

    一个小程序~ public String getYear(Integer year){ if(year<1900){ return "未知"; } Integer start ...

  4. Sql根据经纬度算出距离

    SELECT  ISNULL((2 * 6378.137 * ASIN(SQRT(POWER(SIN((117.223372- ISNULL(Latitude,0) )*PI()/360),2)+CO ...

  5. sql 根据两点经纬度算出两点之间距离

    select (sqrt( ( ((121.544685-longitude)*PI()*12656*cos(((31.134857+latitude)/2)*PI()/180)/180) * ((1 ...

  6. JS根据一个经纬度及距离角度,算出另外一个经纬度

    var mapNumberUtil = {}; /** * 根据一个经纬度及距离角度,算出另外一个经纬度 * @param {*} lng 经度 113.3960698 * @param {*} la ...

  7. CardUtil算出当前身份证持有者的性别和年龄

    import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util ...

  8. Day_10【常用API】扩展案例1_利用人出生日期到当前日期所经过的毫秒值计算出这个人活了多少天

    分析以下需求,并用代码实现: 1.从键盘录入一个日期字符串,格式为 xxxx-xx-xx,代表该人的出生日期 2.利用人出生日期到当前日期所经过的毫秒值计算出这个人活了多少天 package com. ...

  9. 一次 Oracle 算出运算溢出问题 排查解决 (并非除数为零!)

    前段时间 出现过这个问题,: 表中有一列为number类型 rec_recordlength (两个时间的间隔长度/秒) 部分数据 统计这个字段就会出现 "算出运算溢出" 错误,很 ...

随机推荐

  1. 核心游记之 page_address_init

    lock_kernel()仅仅虚晃一枪就过去了. 紧接着来的是page_address_init include/linux/mm.h   #if defined(CONFIG_HIGHMEM) &a ...

  2. Linear Regression(线性回归)(三)—代价函数J(θ)选择的概率解释

    (整理自AndrewNG的课件,转载请注明.整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/) 在遇到线性回归问题时,我们总是令.可是我们为什么这样选择代价函数呢 ...

  3. Thinkphp入门 四 —布局、缓存、系统变量 (48)

    原文:Thinkphp入门 四 -布局.缓存.系统变量 (48) [控制器操作方法参数设置] http://网址/index.php/控制器/操作方法 [页面跳转] [变量调节器] Smarty变量调 ...

  4. jquery prop和attr的区别

    jquery1.6中新加了一个方法prop(),一直没用过它,官方解释只有一句话:获取在匹配的元素集中的第一个元素的属性值. 大家都知道有的浏览器只要写disabled,checked就可以了,而有的 ...

  5. android在其他线程中访问UI线程的方法

    1.Activity.runOnUiThread( Runnable ) 2.View.post( Runnable ) 3.View.postDelayed( Runnable, long ) 4. ...

  6. 使用RNSwipeViewController类库进行视图切换

    如今很多应用已经不再局限于点击按钮触发事件来进行视图之间切换,为迎合给予用户更好体验,体现iOS系统极佳用户体验,使用手势来进行各个视图之间切换,用户至于一个大拇指在屏幕中央就可浏览到很多信息: 关于 ...

  7. HDU 5045(Contest-费用流)[template:费用流]

    Contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submi ...

  8. asp.net 下载任意格式文件 上传文件后台代码

    思路:将文件转化为流,输出到页面上的iframe中去 //下载附件逻辑 object DownLoad(NameValueCollection nv) { int attachId = nv[&quo ...

  9. IOT和HEAP表区别

    Index Organized table by itself is a B-tree index. Index key is the primary key and the rest of colu ...

  10. Objective-C中经常使用的结构体NSRange,NSPoint,NSSize(CGSize),NSRect

    Objective-C中经常使用的结构体NSRange,NSPoint,NSSize(CGSize),NSRect 1   NSRange NSRange 的原型为 typedef struct _N ...