Package xxtest; public class Test {//earth radius public static final Double Earth_radius = 6378137.0;//unit M private static DOUBL
E Getrad (double D) {return d * math.pi/180.0; /** * Two coordinates (latitude and longitude) distance between calculation * GD/BD map using this algorithm * @param startlng start coordinates longitude * @param startlat start coordinates latitude * @p Aram ENDLNG Endpoint coordinates longitude * @param endlat endpoint coordinates latitude * @return The distance between the start and end coordinates unit: m/public static double GETGREATC
Ircledistance (double startlng, double Startlat, double endlng, double Endlat) {Double radLat1 = Getrad (Startlat);
Double radLat2 = Getrad (Endlat); Double dy = radlat1-radlat2; A double dx = Getrad (STARTLNG)-Getrad (ENDLNG); b Double s = 2 * Math.asin (MATH.SQRT (Math.pow (Math.sin (DY/2), 2) + Math.Cos (RADLAT1) * MATH.COS (RADLAT2) * Ma
Th.pow (Math.sin (DX/2), 2));
s = S * earth_radius;
s = Math.Round (S * 10000)/10000.0;
return s; public static void Main (string[] ArGS) {//n 106.486654 degrees north latitude 23.490295 degrees to the east move 4000 meters northward move 3000 m double lng = GETMOVELNG (23.490295, 4000)
+ 106.486654;
Double lat = Getmovelat (3000) + 23.490295;
SYSTEM.OUT.PRINTLN (LAT);
System.out.println (LNG);
System.out.println ("Two point distance after moving (m):" +getgreatcircledistance (106.486654, 23.490295,lng,lat)); /** * Get latitude to move latmovement meters, latitude to move degrees * @param latmovement units: M * @return latitude of the degree of movement/public stat
IC Double Getmovelat (double latmovement) {return (180/(Math.PI * earth_radius)) *latmovement; /** * Obtain longitude movement lngmovement m, Longitude movement degree * @param lat latitude * @param lngmovement unit: M * @return Longitude movement degree Number/public static double getmovelng (double-lat, double lngmovement) {return (180/Math.PI * Earth_radiu
S*math.cos (Math.toradians (LAT))) *lngmovement;
}
}