utmconversions.cpp

来自「GIS地图坐标格式转换程序,大地坐标和UTM投影坐标之间的相互转换」· C++ 代码 · 共 40 行

CPP
40
字号
//UTM Conversion.cpp- test program for lat/long to UTM and UTM to lat/long conversions#include <iostream.h>#include <iomanip.h>#include "LatLong-UTMconversion.h"void main(){//	double Lat = 47.37816667;//	double Long = 8.23250000;
//	double Lat = 47+23/60.0+13.55560/3600;
//	double Long = 8+49/60.0+13.55556/3600;
	double Lat = 0;
	double Long = -174;	double UTMNorthing;	double UTMEasting;	double SwissNorthing;	double SwissEasting;	char UTMZone[4];	int RefEllipsoid = 23;//WGS-84. See list with file "LatLong- UTM conversion.cpp" for id numbers	cout << "Starting position(Lat, Long):  " << Lat << "   " << Long <<endl;	LLtoUTM(Lat, Long, UTMNorthing, UTMEasting, UTMZone,RefEllipsoid);	cout << setiosflags(ios::showpoint | ios::fixed) << setprecision(5);	cout << "Calculated UTM position(Northing, Easting, Zone):  ";	cout << UTMNorthing << "   " << UTMEasting;	cout << "   " << UTMZone <<endl;		UTMtoLL(RefEllipsoid, UTMNorthing, UTMEasting, UTMZone, Lat, Long);	cout << "Calculated Lat, Long position(Lat, Long):  " << Lat << "   " << Long << endl <<endl;	LLtoSwissGrid(Lat, Long, SwissNorthing, SwissEasting);	cout << setiosflags(ios::showpoint | ios::fixed) << setprecision(5);	cout << "Calculated Swiss Grid position(Northing, Easting):  ";	cout << SwissNorthing << "   " << SwissEasting << endl;}/* N 47.38195

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?