GPS 高斯投影 坐标转换 代码

 
//   GaussBL2xy.cpp   :   Defines   the   entry   point   for   the   console   application. 
// 

#include   "stdafx.h " 
#include   "math.h " 
#include   "CoorTrans.h " 
#include   <iostream> 

using   namespace   std; 

void   main(int   argc,   char*   argv[]) 
{ 
  double   MyL0   =   108;   //中央子午线 
  double   MyB   =   33.44556666;   //33   du   44   fen   55.6666   miao 
  double   MyL   =   109.22334444;   //3度带,109   d   22   m   33.4444   s 
  
  PrjPoint_Krasovsky   MyPrj; 
  MyPrj.SetL0(MyL0); 
  MyPrj.SetBL(MyB,   MyL); 
  double   OutMyX;                       //结果应该大致是:3736714.783,   627497.303 
  double   OutMyY; 
  OutMyX   =   MyPrj.x;           //正算结果:   北坐标x 
  OutMyY   =   MyPrj.y;           //结果:东坐标y 
  
  //反算 
  double   InputMyX   =   3736714.783;     //如果是独立计算,应该给出中央子午线L0 
  double   InputMyY   =   627497.303; 
  MyPrj.Setxy(InputMyX,   InputMyY); 
  MyPrj.GetBL(&MyPrj.B,   &MyPrj.L);   //把计算出的BL的弧度值换算为dms形式 
  double   OutputMyB; 
  double   OutputMyL; 
  OutputMyB   =   MyPrj.B;     //反算结果:B 
  OutputMyL   =   MyPrj.L;     //反算结果:L 

  //分析表明,此程序的结果和Coord4.2的转换结果是一样的,只差到毫米级 
        //原程序有几个问题,1.Pi的值不对。2.SetBL中多了两行错误代码 
} 


double   Dms2Rad(double   Dms) 
{ 
  double   Degree,   Miniute; 
  double   Second; 
  int   Sign; 
  double   Rad; 
  if(Dms   > =   0) 
    Sign   =   1; 
  else 
    Sign   =   -1; 
  Dms   =   fabs(Dms); 
  Degree   =   floor(Dms); 
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值