OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_utm_zone.cpp
Go to the documentation of this file.
1 
11 #include <iostream>
12 #include <iomanip>
13 #include <stdio.h>
14 #include "LatLong-UTMconversion.h"
15 
16 int main(int argc, char *argv[]) {
17  if (argc < 3) {
18  std::cerr << "Usage: " << argv[0] << " Lon Lat" << std::endl;
19  return 1;
20  }
21 
22  int ReferenceEllipsoid = 23; //WGS84
23 
24  double Lon, Lat;
25  sscanf(argv[1], "%lf", &Lon);
26  sscanf(argv[2], "%lf", &Lat);
27  double UTMNorthing;
28  double UTMEasting;
29  char UTMZone[10];
30 
31  LLtoUTM(ReferenceEllipsoid, Lat, Lon, UTMNorthing, UTMEasting, UTMZone);
32 
33  std::cout << "+zone=" << UTMZone << std::endl;
34  std::cout << "easting=" << std::fixed << std::setprecision(0)
35  << UTMEasting << std::endl;
36  std::cout << "northing=" << std::fixed << std::setprecision(0)
37  << UTMNorthing << std::endl;
38 }
void LLtoUTM(int ReferenceEllipsoid, const double Lat, const double Long, double &UTMNorthing, double &UTMEasting, char *UTMZone)
int main(int argc, char *argv[])