1#ifndef OSMIUM_GEOM_PROJECTION_HPP
2#define OSMIUM_GEOM_PROJECTION_HPP
51#ifdef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
54# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
56# undef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
79 std::unique_ptr<void, ProjCRSDeleter>
m_crs;
83 explicit CRS(
const char* crs) :
90 explicit CRS(
const std::string& crs) :
94 explicit CRS(
int epsg) :
95 CRS(
std::string{
"+init=epsg:"} +
std::to_string(epsg)) {
101 projPJ
get() const noexcept {
106 return pj_is_latlong(m_crs.get()) != 0;
110 return pj_is_geocent(m_crs.get()) != 0;
126 const int result = pj_transform(src.
get(), dest.
get(), 1, 1, &c.
x, &c.
y,
nullptr);
157 m_proj_string(
std::move(proj_string)),
158 m_crs_user(proj_string) {
163 m_proj_string(proj_string),
164 m_crs_user(proj_string) {
169 m_proj_string(
std::string{
"+init=epsg:"} +
std::to_string(epsg)),
180 if (m_epsg == 4326) {
184 if (m_epsg == 3857) {
186 detail::lat_to_y(location.
lat())};
204 return m_proj_string;
Definition: location.hpp:271
double lon() const
Definition: location.hpp:400
double lat() const
Definition: location.hpp:419
Definition: projection.hpp:71
std::unique_ptr< void, ProjCRSDeleter > m_crs
Definition: projection.hpp:79
CRS(const std::string &crs)
Definition: projection.hpp:90
CRS(int epsg)
Definition: projection.hpp:94
projPJ get() const noexcept
Definition: projection.hpp:101
bool is_latlong() const noexcept
Definition: projection.hpp:105
CRS(const char *crs)
Definition: projection.hpp:83
bool is_geocent() const noexcept
Definition: projection.hpp:109
Definition: projection.hpp:146
int epsg() const noexcept
Definition: projection.hpp:199
Coordinates operator()(osmium::Location location) const
Definition: projection.hpp:179
Projection(const char *proj_string)
Definition: projection.hpp:161
Projection(int epsg)
Definition: projection.hpp:167
std::string m_proj_string
Definition: projection.hpp:149
Projection(std::string proj_string)
Definition: projection.hpp:155
std::string proj_string() const
Definition: projection.hpp:203
int m_epsg
Definition: projection.hpp:148
CRS m_crs_user
Definition: projection.hpp:151
#define OSMIUM_DEPRECATED
Definition: compatibility.hpp:42
OSMIUM_DEPRECATED Coordinates transform(const CRS &src, const CRS &dest, Coordinates c)
Definition: projection.hpp:125
constexpr double deg_to_rad(double degree) noexcept
Convert angle from degrees to radians.
Definition: util.hpp:64
constexpr double rad_to_deg(double radians) noexcept
Convert angle from radians to degrees.
Definition: util.hpp:69
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
Definition: location.hpp:555
Definition: projection.hpp:73
void operator()(void *crs)
Definition: projection.hpp:74
Definition: coordinates.hpp:48
double y
Definition: coordinates.hpp:51
double x
Definition: coordinates.hpp:50