现在的位置: 首页 > 综合 > 正文

54坐标转高斯坐标

2017年12月19日 ⁄ 综合 ⁄ 共 1731字 ⁄ 字号 评论关闭

public void blToGauss(double longitude, double latitude) {
double E8 = (int) longitude;
double F8 = (int) ((longitude - E8) * 60);
double G8 = ((longitude - E8) * 60 - F8) * 60;
DecimalFormat format = new DecimalFormat("#.00");
G8 = Double.valueOf(format.format(G8));
double B8 = (int) latitude;
double C8 = (int) ((latitude - B8) * 60);
double D8 = ((latitude - B8) * 60 - C8) * 60;
D8 = Double.valueOf(format.format(D8));
final double C6 = 6378245;
final double D6 = 6356863.019;
final double E6 = 0.081813334;
final double F6 =0.082088522;
final double G6 = 6399698.902;
final double H6 = 0.00335233;
final double I6 = 6335552.717;
final double PI = Math.PI;
double K8 = 2*PI*(B8+(C8+D8/60)/60)/360;
double L8 = 2*PI*(E8+(F8+G8/60)/60)/360;
double M8 = (int)((E8+(F8+G8/60)/60+1.5)/3)*6*PI/360;
int N8 = (int)((E8+(F8+G8/60)/60+1.5)/3);
double O8 = Math.pow(Math.tan(K8) , 2);
double P8 = Math.pow(F6*Math.cos(K8), 2);
double Q8 = (L8-M8)*Math.cos(K8);
double R8 = C6*((1-Math.pow(E6, 2)/4 - (3* Math.pow(E6,4))/64-(5*Math.pow(E6, 6))/256)*K8-((3*Math.pow(E6,2))/8+(3*Math.pow(E6,4))/32+(45*Math.pow(E6,6))/1024)*Math.sin(2*K8)+((15*Math.pow(E6, 4))/256+(45*Math.pow(E6, 6))/1024)*Math.sin(4*K8)-(35*Math.pow(E6,
6))*Math.sin(6*K8)/3072);
double S8 = G6/Math.pow((1+P8), 0.5);
//System.out.println(K8 +":"+L8+":"+M8+":"+N8+":"+O8+":"+P8+":"+Q8+":"+R8+":"+S8);
double xval = 1*(R8+S8*Math.tan(K8)*(0.5*Math.pow(Q8,2) + (5-O8+9*P8+4*Math.pow(P8,2))*Math.pow(Q8,4)/24)+(61-58*O8+ Math.pow(O8,2)+270*P8-330*O8*P8)*Math.pow(Q8,6)/720);
double yval = (500000+N8*1000000)+1*S8*(Q8+(1-O8+P8)*Math.pow(Q8,3)/6+(5-18*O8+Math.pow(O8,2)+14*P8-58*O8*P8)*Math.pow(Q8,5)/120);

DecimalFormat format2 = new DecimalFormat("#.000");
xval = Double.valueOf(format2.format(xval));
yval = Double.valueOf(format2.format(yval));
System.out.println(xval+":"+yval);
tv1.setText("纬度:" + latitude + "\n经度:" + longitude + "\nX:" + xval +"\nY:"+ yval);
}

抱歉!评论已关闭.