puzhibing
2023-08-16 d5b3e5a413bcfccba294793ee093722f31b2448a
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/GeodesyUtil.java
@@ -13,7 +13,6 @@
/**
 * 计算两个金纬度坐标之间的直线距离
 */
@Component
public class GeodesyUtil {
@@ -23,7 +22,7 @@
     * @param toLonLat
     * @return
     */
    public Map<String, Double> getDistance(String fromLonLat, String toLonLat){
    public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){
        Map<String, Double> map = null;
        if(ToolUtil.isNotEmpty(fromLonLat) && ToolUtil.isNotEmpty(toLonLat)){
            map = new HashMap<>();
@@ -60,7 +59,7 @@
    }
    private double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){
    private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){
        //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离
        GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo);
        return geoCurve.getEllipsoidalDistance();