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>>;
Projection
Enumerator describing the supported projections.
Definition: Definitions.hpp:41
Converts points from spherical to Cartesian coordinate system.
Definition: ProjectionConversions.hpp:110
Projection SourceProjection() const
The coordinate system of the point parameter to the conversion operation.
Definition: ProjectionConversions.hpp:137
Converts points from spherical to Cartesian coordinate system using an ESPG code.
Definition: ProjectionConversions.hpp:99
ConvertSphericalToCartesianBase(const ProjectionConversion &proj)
Constructor with projection.
Definition: ProjectionConversions.hpp:64
Projection TargetProjection() const
The coordinate system of the point result of the conversion operation.
Definition: ProjectionConversions.hpp:76
bg::model::d2::point_xy< double > UTM
Point in x-y space.
Definition: ProjectionConversions.hpp:128
virtual ~ConvertCartesianToSphericalBase()=default
Default destructor.
A struct describing a point in a two-dimensional space.
Definition: Point.hpp:40
boost::geometry::srs::projection< boost::geometry::srs::static_epsg< EpsgCode > > EpsgProjection
The EPSG projection.
Definition: ProjectionConversions.hpp:170
Projection TargetProjection() const
The coordinate system of the point result of the conversion operation.
Definition: ProjectionConversions.hpp:143
double x
X-coordinate.
Definition: Point.hpp:43
Converts points from spherical to Cartesian coordinate system.
Definition: ProjectionConversions.hpp:177
double y
Y-coordinate.
Definition: Point.hpp:44
ConvertSphericalToCartesianEPSG()
Construct spherical to Cartesian with an EPSG code.
Definition: ProjectionConversions.hpp:106
ConvertCartesianToSphericalBase(const ProjectionConversion &proj)
Constructor with projection.
Definition: ProjectionConversions.hpp:131
Namespace alias for boost::geometry.
Definition: ProjectionConversions.hpp:54
ConvertSphericalToCartesian(const std::string &zone)
Construct spherical to Cartesian with an zone string.
Definition: ProjectionConversions.hpp:114
Converts points from spherical to Cartesian coordinate system.
Definition: ProjectionConversions.hpp:121
ConvertCartesianToSphericalEPSG()
Construct spherical to Cartesian with an EPSG code.
Definition: ProjectionConversions.hpp:173
Contains the logic of the C++ static library.
Definition: AveragingInterpolation.hpp:36
virtual ~ConvertSphericalToCartesianBase()=default
Default destructor.
bg::model::d2::point_xy< double, Projection > UTM
Point in x-y space.
Definition: ProjectionConversions.hpp:61
ConvertCartesianToSpherical(const std::string &zone)
Construct spherical to Cartesian with an zone string.
Definition: ProjectionConversions.hpp:181
Point operator()(const Point &pnt) const
Apply the conversion of a point in Cartesian coordinate system to spherical.
Definition: ProjectionConversions.hpp:149
Projection SourceProjection() const
The coordinate system of the point parameter to the conversion operation.
Definition: ProjectionConversions.hpp:70
bg::model::d2::point_xy< double, bg::cs::geographic< bg::degree > > LongLat
point in longitude-latitude space
Definition: ProjectionConversions.hpp:58
bg::srs::projection< bg::srs::static_epsg< EpsgCode > > EpsgProjection
The EPSG projection.
Definition: ProjectionConversions.hpp:103
Point operator()(const Point &pnt) const
Apply the conversion of a point in Spherical coordinate system to Cartesian.
Definition: ProjectionConversions.hpp:82
bg::model::d2::point_xy< double, bg::cs::geographic< bg::degree > > LongLat
point in longitude-latitude space
Definition: ProjectionConversions.hpp:125
Converts points from spherical to Cartesian coordinate system using an EPSG code.
Definition: ProjectionConversions.hpp:166