Goby3  3.1.5a
2024.05.23
geodesy.h
Go to the documentation of this file.
1 // Copyright 2018-2022:
2 // GobySoft, LLC (2013-)
3 // Community contributors (see AUTHORS file)
4 // File authors:
5 // Toby Schneider <toby@gobysoft.org>
6 //
7 //
8 // This file is part of the Goby Underwater Autonomy Project Libraries
9 // ("The Goby Libraries").
10 //
11 // The Goby Libraries are free software: you can redistribute them and/or modify
12 // them under the terms of the GNU Lesser General Public License as published by
13 // the Free Software Foundation, either version 2.1 of the License, or
14 // (at your option) any later version.
15 //
16 // The Goby Libraries are distributed in the hope that they will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public License
22 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
23 
24 #ifndef GOBY_UTIL_GEODESY_H
25 #define GOBY_UTIL_GEODESY_H
26 
27 #include <boost/units/quantity.hpp> // for quantity
28 #include <boost/units/systems/angle/degrees.hpp> // for plane_angle
29 #include <boost/units/systems/si/length.hpp> // for length
30 
31 
32 namespace goby
33 {
34 namespace util
35 {
37 {
38  public:
39  struct LatLonPoint
40  {
41  boost::units::quantity<boost::units::degree::plane_angle> lat;
42  boost::units::quantity<boost::units::degree::plane_angle> lon;
43  };
44 
45  struct XYPoint
46  {
47  boost::units::quantity<boost::units::si::length> x;
48  boost::units::quantity<boost::units::si::length> y;
49  };
50 
51  UTMGeodesy(const LatLonPoint& origin);
52  virtual ~UTMGeodesy();
53 
54  LatLonPoint origin_geo() const { return origin_geo_; }
55  XYPoint origin_utm() const { return origin_utm_; }
56  int origin_utm_zone() const { return origin_zone_; }
57 
58  LatLonPoint convert(const XYPoint& utm) const;
59  XYPoint convert(const LatLonPoint& geo) const;
60 
61  private:
62  LatLonPoint origin_geo_;
63  int origin_zone_;
64  XYPoint origin_utm_;
65 
66  // proj4
67  void *pj4_utm_, *pj4_latlong_;
68 
69  // proj6+
70  void *pj6_;
71 };
72 } // namespace util
73 } // namespace goby
74 
75 #endif
goby::util::UTMGeodesy::XYPoint
Definition: geodesy.h:45
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::util::UTMGeodesy::origin_utm_zone
int origin_utm_zone() const
Definition: geodesy.h:56
goby::util::UTMGeodesy::LatLonPoint::lon
boost::units::quantity< boost::units::degree::plane_angle > lon
Definition: geodesy.h:42
goby::util::UTMGeodesy::origin_utm
XYPoint origin_utm() const
Definition: geodesy.h:55
goby::util::UTMGeodesy::XYPoint::x
boost::units::quantity< boost::units::si::length > x
Definition: geodesy.h:47
goby::util::UTMGeodesy
Definition: geodesy.h:36
goby::util::UTMGeodesy::UTMGeodesy
UTMGeodesy(const LatLonPoint &origin)
goby::util::UTMGeodesy::convert
LatLonPoint convert(const XYPoint &utm) const
goby::util::UTMGeodesy::origin_geo
LatLonPoint origin_geo() const
Definition: geodesy.h:54
goby::util::UTMGeodesy::LatLonPoint
Definition: geodesy.h:39
goby::util::UTMGeodesy::LatLonPoint::lat
boost::units::quantity< boost::units::degree::plane_angle > lat
Definition: geodesy.h:41
goby::util::UTMGeodesy::XYPoint::y
boost::units::quantity< boost::units::si::length > y
Definition: geodesy.h:48
goby::util::UTMGeodesy::~UTMGeodesy
virtual ~UTMGeodesy()