1 #ifndef OSMIUM_GEOM_PROJECTION_HPP 2 #define OSMIUM_GEOM_PROJECTION_HPP 50 #ifdef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 51 # include <proj_api.h> 53 # define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 54 # include <proj_api.h> 55 # undef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 76 std::unique_ptr<void, ProjCRSDeleter>
m_crs;
80 explicit CRS(
const char* crs) :
87 explicit CRS(
const std::string& crs) :
91 explicit CRS(
int epsg) :
92 CRS(
std::string{
"+init=epsg:"} + std::to_string(epsg)) {
98 projPJ
get()
const noexcept {
103 return pj_is_latlong(m_crs.get()) != 0;
107 return pj_is_geocent(m_crs.get()) != 0;
122 const int result = pj_transform(src.
get(), dest.
get(), 1, 1, &c.
x, &c.
y,
nullptr);
151 m_proj_string(proj_string),
152 m_crs_user(proj_string) {
157 m_proj_string(proj_string),
158 m_crs_user(proj_string) {
163 m_proj_string(
std::string{
"+init=epsg:"} + std::to_string(epsg)),
174 if (m_epsg == 4326) {
178 if (m_epsg == 3857) {
180 detail::lat_to_y(location.
lat())};
198 return m_proj_string;
207 #endif // OSMIUM_GEOM_PROJECTION_HPP double y
Definition: coordinates.hpp:51
projPJ get() const noexcept
Definition: projection.hpp:98
double lon() const
Definition: location.hpp:395
std::string proj_string() const
Definition: projection.hpp:197
bool is_latlong() const noexcept
Definition: projection.hpp:102
Definition: projection.hpp:70
double lat() const
Definition: location.hpp:414
Definition: location.hpp:550
CRS(int epsg)
Definition: projection.hpp:91
bool is_geocent() const noexcept
Definition: projection.hpp:106
Projection(int epsg)
Definition: projection.hpp:161
CRS(const std::string &crs)
Definition: projection.hpp:87
Coordinates transform(const CRS &src, const CRS &dest, Coordinates c)
Definition: projection.hpp:121
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
constexpr double deg_to_rad(double degree) noexcept
Convert angle from degrees to radians.
Definition: util.hpp:62
std::string m_proj_string
Definition: projection.hpp:143
Definition: coordinates.hpp:48
CRS m_crs_user
Definition: projection.hpp:145
std::unique_ptr< void, ProjCRSDeleter > m_crs
Definition: projection.hpp:76
CRS(const char *crs)
Definition: projection.hpp:80
Definition: projection.hpp:140
Definition: location.hpp:271
int m_epsg
Definition: projection.hpp:142
void operator()(void *crs)
Definition: projection.hpp:71
Definition: projection.hpp:68
Projection(const std::string &proj_string)
Definition: projection.hpp:149
Projection(const char *proj_string)
Definition: projection.hpp:155
int epsg() const noexcept
Definition: projection.hpp:193
double x
Definition: coordinates.hpp:50
Coordinates operator()(osmium::Location location) const
Definition: projection.hpp:173
constexpr double rad_to_deg(double radians) noexcept
Convert angle from radians to degrees.
Definition: util.hpp:67