"Go" GPS latitude and longitude data converted to a planar coordinate system in meters units

Source: Internet
Author: User

Previously found on the internet, now do not know where the source is, hehe ...

Reprint it out.

1 //Cartesian coordinate system2typedefstructtagcrdcartesian{3 Doublex; 4 Doubley; 5 DoubleZ; 6}crdcartesian,*Pcrdcartesian; 7 //typedef Crdcartesian *pcrdcartesian; 8 //Geodetic Coordinate system9typedefstructtagcrdgeodetic{Ten Doublelongitude;//Longitude One DoubleLatitude//Latitude A DoubleHeight//Earth height, can be set to 0 - }crdgeodetic;  -typedef crdgeodetic *pcrdgeodetic;  the    - voidCoordcovert::geodetictocartesian (Pcrdcartesian PCC, pcrdgeodetic pcg, - DoubleDsemimajoraxis,Doubledflattening) - {   +     DoubleB//Latitude degrees -     DoubleL//Degrees of longitude +     DoubleL0;//Central Meridian Degree A     DoubleL//l-l0 at     DoubleT//TANB -     DoubleM//LTANB -     DoubleN//radius of curvature of the unitary circle of Mao -     DoubleQ2;  -     DoubleX//Gaussian plane ordinate -     DoubleY//Gaussian plane horizontal axis in     DoubleS//longitude arc length of equator to latitude B -     DoubleF//The flattening ratio of the reference ellipsoidal body to     DoubleE2;//ellipsoid First eccentricity +     DoubleA//reference ellipsoid body length half axis -     //double b; //reference ellipsoid short half axis the     DoubleA1;  *     DoubleA2;  $     DoubleA3; Panax Notoginseng     DoubleA4;  -     DoubleB1;  the     DoubleB2;  +     DoubleB3;  A     Doubleb4;  the     DoubleC0;  +     DoubleC1;  -     DoubleC2;  $     DoubleC3;  $     intdatum= -;//projection plane type: Beijing 54 Datum plane is 54, Xi ' an 80 datum plane is 80,wgs84 datum plane -     intprjno=0;//Projection Band Number -     intZonewide=3;  the     DoubleIpi=0.0174532925199433333333;//3.1415926535898/180.0 -B=pcg->latitude;//LatitudeWuyiL=pcg->longitude;//Longitude the     if(zonewide==6)    -     {   WuPrjno= (int) (L/zonewide) +1;  -l0=prjno*zonewide-3;  About     }   $     Else   -     {   -Prjno= (int) ((l1.5)/3)+1;  -l0=prjno*3;  A     }   +        the     if(datum== Wu)   -     {   $A=6378245;  thef=1/298.3;  the     }       the     Else if(datum== -)   the     {   -A=6378137;  inf=1/298.257223563;  the     }   thel0=l0*IPI;  Aboutl=l*IPI;  theb=b*IPI;  theE2=2*f-f*f;//(a*a-b*b)/(A*A);  thel=l-L0;  +t=Tan (B);  -M=l *cos (B);  theN=A/SQRT (1-e2* sin (B) *sin (B)); Bayiq2=e2/(1-E2) * COS (B) *cos (B);  thea1=1+(Double)3/4*e2+ (Double) $/ -*e2*e2+ (Double)175/ the*e2*e2*e2+ (Double)11025/16384*e2*e2*e2*e2+ (Double)43659/65536*e2*e2*e2*e2*E2;  theA2= (Double)3/4*e2+ (Double) the/ -*e2*e2+ (Double)525/ +*e2*e2*e2+ (Double)2205/2048*e2*e2*e2*e2+ (Double)72765/65536*e2*e2*e2*e2*E2;  -A3= (Double) the/ -*e2*e2+ (Double) the/ the*e2*e2*e2+ (Double)2205/4096*e2*e2*e2*e2+ (Double)10359/16384*e2*e2*e2*e2*E2;  -A4= (Double) */ +*e2*e2*e2+ (Double)315/2048*e2*e2*e2*e2+ (Double)31185/13072*e2*e2*e2*e2*E2;  theb1=a1*a* (1-E2);  theB2= (Double)-1/2*a2*a* (1-E2);  theB3= (Double)1/4*a3*a* (1-E2);  theB4= (Double)-1/6*a4*a* (1-E2);  -c0=B1;  thec1=2*b2+4*b3+6*b4;  thec2=-(8*b3+ +*b4);  thec3= +*b4; 94S=c0*b+cos (b) * (C1*sin (b) +c2*sin (b) *sin (b) *sin (b) +c3*sin (b) *sin (b) *sin (b) *sin (b) *sin (B));  theX=s+ (Double)1/2*n*t*m*m+ (Double)1/ -*(5-t*t+9*q2+4*Q2*Q2) *n*t*m*m*m*m+ (Double)1/720*( A- -*T*T+T*T*T*T) *n*t*m*m*m*m*m*m;  they=n*m+ (Double)1/6*(1-T*T+Q2) *n*m*m*m+ (Double)1/ -*(5- -*t*t+t*t*t*t- -*q2- -*Q2*T*T) *n*m*m*m*m*m;  they=y+1000000*prjno+500000; 98pcc->x=x;  Aboutpcc->y=y-38000000;  -pcc->z=0; 101}

"Go" GPS latitude and longitude data converted to a planar coordinate system in meters units

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.