标签:center art alc ips 坐标 new tar 备忘 根据
学习记录
1、maven 依赖
<dependency> <groupId>org.gavaghan</groupId> <artifactId>geodesy</artifactId> <version>1.1.3</version> </dependency>
2、生产点坐标
GlobalCoordinates center = new GlobalCoordinates(38.885791,121.858205);
3、根据两点算距离
/** * 根据坐标算距离 * @param startLng * @param startLat * @param endLng * @param endLat * @return */ public static double getDistanceMeter(double startLng,double startLat,double endLng,double endLat){ GlobalCoordinates startGlobalCoordinates = new GlobalCoordinates(startLat, startLng); GlobalCoordinates endGlobalCoordinates = new GlobalCoordinates(endLat, endLng); GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.WGS84, startGlobalCoordinates, endGlobalCoordinates); return geoCurve.getEllipsoidalDistance(); }
4、根据开始点、方向、距离计算结束点
/** * 根据开始坐标点,角度,计算结束点坐标 * @param startGlobalCoordinates * @param startAngle * @param distance * @return */ public static GlobalCoordinates getGlobalCoordinates(GlobalCoordinates startGlobalCoordinates, double startAngle, double distance){ return new GeodeticCalculator().calculateEndingGlobalCoordinates(Ellipsoid.WGS84, startGlobalCoordinates, startAngle, distance); }
学习备忘,好记性的烂笔头!!!
标签:center art alc ips 坐标 new tar 备忘 根据
原文地址:https://www.cnblogs.com/spqin/p/13363836.html