我做了一些代码来模拟北/南和东/西
public static double eastMove(double d, double lat) {
System.out.println("old North no longitude " + "," + lat);
double newLatitude;
double coef = d * 0.0000089;
newLatitude = lat + coef;
return newLatitude;
}
public static double northMove(double d, double lat, double lon) {
System.out.println("old east" + lon + "," + lat);
double newlongitude;
double coef = d * 0.0000089;
newlongitude = lon + coef / Math.cos(lat * 0.018);
return newlongitude;
}
使用这两个功能:
newLongitude = northMove(15,Latitude,longitude);
System.out.print("to North location");
System.out.print(newLongitude );
System.out.print(",");
System.out.println(Latitude);
newLatitude = eastMove(15,latitude);
System.out.print("to East location");
System.out.print(Longitude);
System.out.print(",");
System.out.println(newLatitude );