大地测量-高斯投影正反算
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
大地测量高斯投影正反算程序代码
课程:大地测量学基础
姓名:林江伟
学号:2008301610045
班级: 0804
界面如下:
输入数据计算:
using System;
using System.Collections.Generic; using ponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace大地
{
public partial class Form1 : Form {
double B, L;
double x, y;
double X, Y;
int N;
double L0, l1;
double p=206264.80625;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//自动化控件显示初始值
radioButton2.Checked=true;
radioButton3.Checked = true;
textBox1.Focus();
textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = textBox6.Text = "0";
this.richTextBox2.Text = "说明:输入的坐标需为按6°带投影且采用克氏椭球参数所得的国家统一坐标";
}
private void button1_Click(object sender, EventArgs e)
{
//获取输入数据
double bb1=Convert.ToDouble(this.textBox1.Text);
double bb2=Convert.ToDouble(this.textBox2.Text);
double bb3=Convert.ToDouble(this.textBox3.Text);
double ll1=Convert.ToDouble(this.textBox4.Text);
double ll2=Convert.ToDouble(this.textBox5.Text);
double ll3=Convert.ToDouble(this.textBox6.Text);
//检查输入格式的正确性
if (bb1 >= 0 && bb1 <90 && bb2 >= 0 && bb2 < 60 && bb3 >= 0 && bb3 < 60)
{
B = bb1 * 3600 + bb2 * 60 + bb3;
}
else
{
MessageBox.Show("纬度输入格式不正确!", "警告");
return;
}
if (ll1 >= 0 && ll1<360 && ll2 >= 0 && ll2 < 60 && ll3 >= 0 && ll3 < 60)
{
L = ll1 * 3600 + ll2 * 60 + ll3;
}
else
{
MessageBox.Show("经度输入格式不正确!", "警告");
return;
}
double b = B/p;
//获取用户选项值
int tyd=radioButton1.Checked?3:6;
int tq=radioButton3.Checked?1:2;
//按带求带号以及中央子午线经度
if (tyd == 6)
{
N =(int)( L / (6*3600.0)) + 1;
L0 = (6 * N - 3)*3600.0;
l1 = (L-L0)/p;
}
if(tyd==3)
{
N =(int)(L / (3*3600.0)+0.5);
L0 = 3 * N * 3600.0;
l1 =( L-L0)/p;
}
//采用克氏椭球参数的计算公式
if (tq == 1)
{
double c = Math.Pow( Math.Cos(b),2);
double c1= Math.Sin(b) * Math.Cos(b);
double c2=Math.Cos(b);
double l2 = Math.Pow(l1,2);
double n = 6399698.902 - (21562.267 - (108.973 - 0.612 * c) * c) * c;
double a0 = 32140.404 - (135.3302 - (0.7092 - 0.0040 * c) * c) * c;
double a4 = (0.25 + 0.00252 * c) * c - 0.04166;
double a6 = (0.166 * c - 0.084) * c;
double a3 = (0.3333333 + 0.001123 * c) * c - 0.1666667;
double a5 = 0.0083 - (0.1667 - (0.1968 + 0.0040 * c) * c) * c;
x = 6367558.4969 * b - (a0 - (0.5 + (a4 + a6 * l2) * l2) * l2 * n) *c1; y = (1 + (a3 + a5 * l2) * l2) * l1 * n * c2;
X = x;
double y1 = y + 500000.0;
for (int i = 1; y1 / i > 1; i = i * 10)
{
Y = N * i*10 + y1;
}
string tuoqiu = "采用克氏椭球参数,";