是否有任何已知的Java库可让我将WGS 84线转换为OSGB36,或者是否有可以使用的良好公式?我目前正在使用此工具,但是它不是很准确,所以我想知道是否可以使用更好的工具。
private static double[] Wgs84ToBNG(double inLat, double inLon) {
double lat = inLat * Math.PI / 180.0;
double lon = inLon * Math.PI / 180.0;
double a = 6377563.396; // Airy 1830 major & minor semi-axes
double b = 6356256.910;
double F0 = 0.9996012717; // NatGrid scale factor on central meridian
double lat0 = 49 * Math.PI / 180.0; // NatGrid true origin
double lon0 = -2 * Math.PI / 180.0;
double N0 = -100000; // northing & easting of true origin, metres
double E0 = 400000;
double e2 = 1 - (b * b) / (a * a); // eccentricity squared
double n = (a - b) / (a + b), n2 = n * n, n3 = n * n * n;
double cosLat = Math.cos(lat), sinLat = Math.sin(lat);
double nu = a * F0 / Math.sqrt(1 - e2 * sinLat * sinLat); // transverse
// radius of
// curvature
double rho = a * F0 * (1 - e2)
/ Math.pow(1 - e2 * sinLat * sinLat, 1.5); // meridional radius
// of curvature
double eta2 = nu / rho - 1;
double Ma = (1 + n + (5 / 4) * n2 + (5 / 4) * n3) * (lat - lat0);
double Mb = (3 * n + 3 * n * n + (21 / 8) * n3) * Math.sin(lat - lat0)
* Math.cos(lat + lat0);
double Mc = ((15 / 8) * n2 + (15 / 8) * n3)
* Math.sin(2 * (lat - lat0)) * Math.cos(2 * (lat + lat0));
double Md = (35 / 24) * n3 * Math.sin(3 * (lat - lat0))
* Math.cos(3 * (lat + lat0));
double M = b * F0 * (Ma - Mb + Mc - Md); // meridional arc
double cos3lat = cosLat * cosLat * cosLat;
double cos5lat = cos3lat * cosLat * cosLat;
double tan2lat = Math.tan(lat) * Math.tan(lat);
double tan4lat = tan2lat * tan2lat;
double I = M + N0;
double II = (nu / 2) * sinLat * cosLat;
double III = (nu / 24) * sinLat * cos3lat * (5 - tan2lat + 9 * eta2);
double IIIA = (nu / 720) * sinLat * cos5lat
* (61 - 58 * tan2lat + tan4lat);
double IV = nu * cosLat;
double V = (nu / 6) * cos3lat * (nu / rho - tan2lat);
double VI = (nu / 120)
* cos5lat
* (5 - 18 * tan2lat + tan4lat + 14 * eta2 - 58 * tan2lat * eta2);
double dLon = lon - lon0;
double dLon2 = dLon * dLon;
double dLon3 = dLon2 * dLon;
double dLon4 = dLon3 * dLon;
double dLon5 = dLon4 * dLon;
double dLon6 = dLon5 * dLon;
double N = I + II * dLon2 + III * dLon4 + IIIA * dLon6;
double E = E0 + IV * dLon + V * dLon3 + VI * dLon5;
double[] returnValue = { E, N };
return returnValue;
}
最佳答案
看看这个page
在“程序/源代码”部分中,您可以找到标题为“ WGS84 Lat / Long OSGB36 Grid References”的小节。在本小节中,有几个指向提供此功能的实用程序的链接。
在其他post中,您可以找到带有说明的此类任务的源代码。