Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Proj6 Class Reference

#include <Proj6.h>

Inheritance diagram for Proj6:
Inheritance graph
[legend]
Collaboration diagram for Proj6:
Collaboration graph
[legend]

Public Member Functions

 Proj6 (const Proj6 &p)
 
void setProjectionSrc (const std::string &projDef, Projector::CRS_mode crs=Projector::FORCE_CRS)
 Sets source projection.
 
void setProjectionDst (const std::string &projDef, Projector::CRS_mode crs=Projector::FORCE_CRS)
 Sets destination projection.
 
void setProjections (const std::string &projDefSrc, const std::string &projDefDst)
 Sets source and destination projection.
 
const std::string & getProjectionSrc () const
 Returns the projection std::string applied by the last setProjection call. More...
 
const std::string & getProjectionDst () const
 
const ProjectorgetSrc () const
 
const ProjectorgetDst () const
 
void projectFwd (double &x, double &y) const
 Forward projection (in-place)
 
void projectFwd (double x, double y, double &x2, double &y2) const
 Forward projection.
 
void projectFwd (drain::Point2D< double > &point) const
 Forward projection. Example implementation of project<>() .
 
void projectInv (double &x, double &y) const
 
void projectInv (double x, double y, double &x2, double &y2) const
 
void projectInv (drain::Point2D< double > &point) const
 
void debug (std::ostream &ostr=std::cout, int wkt=-1)
 Forward projection. More...
 
bool isLongLat () const
 Check if destination projection is longitude-latitude degrees.
 
bool isSet () const
 
std::string getErrorString () const
 

Static Public Member Functions

static const std::string & getProjVersion ()
 

Public Attributes

Projector src
 
Projector dst
 

Protected Member Functions

template<PJ_DIRECTION D, class POINT_XY >
void project (POINT_XY &point) const
 
template<PJ_DIRECTION D>
void project (double &x, double &y) const
 
void setMapping (bool lenient)
 

Protected Attributes

PJ_CONTEXT * pjContext = nullptr
 Detect EPSG code from "+init=epsg:EPSG" argument. More...
 
PJ * proj = nullptr
 

Detailed Description

A wrapper for the famous Proj6 class.

proj_context_errno(PJ_CONTEXT *ctx) -> const char *proj_errno_string(int err)

IMPORTANT:

https://proj.org/development/reference/functions.html#c.proj_create If a proj-string contains a +type=crs option, then it is interpreted as a CRS definition. In particular geographic CRS are assumed to have axis in the longitude, latitude order and with degree angular unit. The use of proj-string to describe a CRS is discouraged. It is a legacy means of conveying CRS descriptions: use of object codes (EPSG:XXXX typically) or WKT description is recommended for better expressivity.

Member Function Documentation

◆ debug()

void debug ( std::ostream &  ostr = std::cout,
int  wkt = -1 
)
inline

Forward projection.

Forward projection. Todo: projections for vectors inline Inverse projection. Inverse projection from (x2,y2) to (x,y).

◆ getProjectionSrc()

const std::string& getProjectionSrc ( ) const
inline

Returns the projection std::string applied by the last setProjection call.

! Get a PROJ string representation of an object.

Does not reconstruct it from the allocated proj structure.

◆ project()

void project ( POINT_XY &  point) const
inlineprotected
Template Parameters
POINT_XY– anything with members double x and double y
D- PJ_DIRECTION enum value (libproj)

Member Data Documentation

◆ pjContext

PJ_CONTEXT* pjContext = nullptr
protected

Detect EPSG code from "+init=epsg:EPSG" argument.

\param projDef – PROJ.4 projection definition string
\return – EPSG code, if found, else 0.

\see getEpsgDict()

static inline short int pickEpsgCodeOLD(const std::string & projDef){ std::list<std::string> projArgs; return pickEpsgCodeOLD(projDef, projArgs); }


The documentation for this class was generated from the following files: