32#if defined(__linux__) || defined(__APPLE__)
33#pragma GCC diagnostic push
34#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
37#define BOOST_ALLOW_DEPRECATED_HEADERS
38#include <boost/geometry.hpp>
39#include <boost/geometry/srs/epsg.hpp>
40#undef BOOST_ALLOW_DEPRECATED_HEADERS
42#if defined(__linux__) || defined(__APPLE__)
43#pragma GCC diagnostic pop
50 namespace bg = boost::geometry;
53 template <
typename ProjectionConversion>
58 using LongLat = bg::model::d2::point_xy<double, bg::cs::geographic<bg::degree>>;
61 using UTM = bg::model::d2::point_xy<double, Projection>;
72 return Projection::spherical;
78 return Projection::cartesian;
86 m_projection.forward(longLat, utm);
88 Point result(utm.x(), utm.y());
94 ProjectionConversion m_projection;
98 template <const
int EpsgCode>
120 template <
typename ProjectionConversion>
125 using LongLat = bg::model::d2::point_xy<double, bg::cs::geographic<bg::degree>>;
128 using UTM = bg::model::d2::point_xy<double>;
139 return Projection::cartesian;
145 return Projection::spherical;
151 UTM utm{pnt.
x, pnt.
y};
153 m_projection.inverse(utm, longLat);
155 Point result(longLat.x(), longLat.y());
161 ProjectionConversion m_projection;
165 template <const
int EpsgCode>
170 using EpsgProjection = boost::geometry::srs::projection<boost::geometry::srs::static_epsg<EpsgCode>>;
Converts points from spherical to Cartesian coordinate system.
Definition ProjectionConversions.hpp:122
Projection SourceProjection() const
The coordinate system of the point parameter to the conversion operation.
Definition ProjectionConversions.hpp:137
Projection TargetProjection() const
The coordinate system of the point result of the conversion operation.
Definition ProjectionConversions.hpp:143
bg::model::d2::point_xy< double, bg::cs::geographic< bg::degree > > LongLat
point in longitude-latitude space
Definition ProjectionConversions.hpp:125
virtual ~ConvertCartesianToSphericalBase()=default
Default destructor.
Point operator()(const Point &pnt) const
Apply the conversion of a point in Cartesian coordinate system to spherical.
Definition ProjectionConversions.hpp:149
bg::model::d2::point_xy< double > UTM
Point in x-y space.
Definition ProjectionConversions.hpp:128
ConvertCartesianToSphericalBase(const ProjectionConversion &proj)
Constructor with projection.
Definition ProjectionConversions.hpp:131
Converts points from spherical to Cartesian coordinate system using an EPSG code.
Definition ProjectionConversions.hpp:167
boost::geometry::srs::projection< boost::geometry::srs::static_epsg< EpsgCode > > EpsgProjection
The EPSG projection.
Definition ProjectionConversions.hpp:170
ConvertCartesianToSphericalEPSG()
Construct spherical to Cartesian with an EPSG code.
Definition ProjectionConversions.hpp:173
Converts points from spherical to Cartesian coordinate system.
Definition ProjectionConversions.hpp:178
ConvertCartesianToSpherical(const std::string &zone)
Construct spherical to Cartesian with an zone string.
Definition ProjectionConversions.hpp:181
Namespace alias for boost::geometry.
Definition ProjectionConversions.hpp:55
bg::model::d2::point_xy< double, bg::cs::geographic< bg::degree > > LongLat
point in longitude-latitude space
Definition ProjectionConversions.hpp:58
ConvertSphericalToCartesianBase(const ProjectionConversion &proj)
Constructor with projection.
Definition ProjectionConversions.hpp:64
bg::model::d2::point_xy< double, Projection > UTM
Point in x-y space.
Definition ProjectionConversions.hpp:61
Point operator()(const Point &pnt) const
Apply the conversion of a point in Spherical coordinate system to Cartesian.
Definition ProjectionConversions.hpp:82
Projection SourceProjection() const
The coordinate system of the point parameter to the conversion operation.
Definition ProjectionConversions.hpp:70
virtual ~ConvertSphericalToCartesianBase()=default
Default destructor.
Projection TargetProjection() const
The coordinate system of the point result of the conversion operation.
Definition ProjectionConversions.hpp:76
Converts points from spherical to Cartesian coordinate system using an ESPG code.
Definition ProjectionConversions.hpp:100
bg::srs::projection< bg::srs::static_epsg< EpsgCode > > EpsgProjection
The EPSG projection.
Definition ProjectionConversions.hpp:103
ConvertSphericalToCartesianEPSG()
Construct spherical to Cartesian with an EPSG code.
Definition ProjectionConversions.hpp:106
Converts points from spherical to Cartesian coordinate system.
Definition ProjectionConversions.hpp:111
ConvertSphericalToCartesian(const std::string &zone)
Construct spherical to Cartesian with an zone string.
Definition ProjectionConversions.hpp:114
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
double x
X-coordinate.
Definition Point.hpp:43
double y
Y-coordinate.
Definition Point.hpp:44
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43