Commit 93443687 by wangli

计算坐标点直线距离

1 parent d7a0ecd2
package com.dituhui.pea.order.common;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;
public class Distance {
public long calculateDistance(double lat1, double lnt1, double lat2, double lnt2) {
GlobalCoordinates source = new GlobalCoordinates(lat1, lnt1);
GlobalCoordinates target = new GlobalCoordinates(lat2, lnt2);
GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.WGS84, source, target);
return Math.round(geoCurve.getEllipsoidalDistance());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!