84 typedef enum GEO_DISTANCES {
100 Coords(
const std::string& in_coordinatesystem,
const std::string& in_parameters=
"");
101 Coords(
const std::string& in_coordinatesystem,
const std::string& in_parameters, std::string coord_spec);
102 Coords(
const double& in_lat_ref,
const double& in_long_ref);
110 void moveByXY(
const double& x_displacement,
const double& y_displacement);
111 void moveByBearing(
const double& i_bearing,
const double& i_distance);
120 double getLon()
const {
return longitude;}
126 void getProj(std::string& proj_type, std::string& proj_args)
const;
129 const std::string
toString(
const FORMATS& type =
DEBUG)
const;
134 void setLatLon(
const double in_latitude,
const double in_longitude,
const double in_altitude,
const bool in_update=
true);
135 void setLatLon(
const std::string& in_coordinates,
const double in_altitude,
const bool in_update=
true);
136 void setXY(
const double in_easting,
const double in_northing,
const double in_altitude,
const bool in_update=
true);
137 void setGridIndex(
const int in_grid_i,
const int in_grid_j,
const int in_grid_k,
const bool setValid=
false);
138 void setAltitude(
const double in_altitude,
const bool in_update=
true);
139 void setProj(
const std::string& in_coordinatesystem,
const std::string& in_parameters=
"");
140 void setLocalRef(
const double in_ref_latitude,
const double in_ref_longitude);
145 void check(
const std::string& pre_msg=
"");
152 void convert_to_WGS84(
double i_easting,
double i_northing,
double& o_latitude,
double& o_longitude)
const;
153 void convert_from_WGS84(
double i_latitude,
double i_longitude,
double& o_easting,
double& o_northing)
const;
155 void WGS84_to_local(
double lat_in,
double long_in,
double& east_out,
double& north_out)
const;
156 void local_to_WGS84(
double east_in,
double north_in,
double& lat_out,
double& long_out)
const;
157 void WGS84_to_NULL(
double lat_in,
double long_in,
double& east_out,
double& north_out)
const;
158 void NULL_to_WGS84(
double east_in,
double north_in,
double& lat_out,
double& long_out)
const;
161 void distance(
const Coords& destination,
double& o_distance,
double& o_bearing)
const;
164 void clearCoordinates();
165 void setDefaultValues();
168 double ref_latitude, ref_longitude;
170 double latitude, longitude;
171 double easting, northing;
172 int grid_i, grid_j, grid_k;
175 std::string coordsystem, coordparam;
176 geo_distances distance_algo;
double getAltitude() const
Definition: Coords.h:121
double getNorthing() const
Definition: Coords.h:118
const std::string toString(const FORMATS &type=DEBUG) const
Print the content of the Coords object (useful for debugging) The Coords is bound by "<Coords>" and "...
Definition: Coords.cc:221
double getEasting() const
Definition: Coords.h:117
void check(const std::string &pre_msg="")
Check consistency of coordinates When both latitude/longitude and easting/northing are given...
Definition: Coords.cc:679
bool isNodata() const
move the point by the specified distance (in m) along easting and northing
Definition: Coords.cc:131
void setXY(const double in_easting, const double in_northing, const double in_altitude, const bool in_update=true)
Set easting and northing The automatic update of the latitude/longitude can be turned off so that bot...
Definition: Coords.cc:527
FORMATS
Keywords for selecting the toString formats.
Definition: Coords.h:90
void getProj(std::string &proj_type, std::string &proj_args) const
Returns the projection parameters.
Definition: Coords.cc:461
Simplified, lat/lon only.
Definition: Coords.h:93
As much information as possible, useful for debugging.
Definition: Coords.h:91
static Coords merge(const Coords &coord1, const Coords &coord2)
Simple merge strategy. If some fields of the first argument are empty, they will be filled by the mat...
Definition: Coords.cc:173
int getGridJ() const
Definition: Coords.h:123
Coords()
Default constructor This constructor builds a dummy object that performs no conversions but can be us...
Definition: Coords.cc:319
void setLocalRef(const double in_ref_latitude, const double in_ref_longitude)
Set the local projection reference coordinates This projection will be used for converting between la...
Definition: Coords.cc:634
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:81
short int getEPSG() const
returns the epsg code of the current projection
Definition: Coords.cc:769
friend std::istream & operator>>(std::istream &is, Coords &coord)
Definition: Coords.cc:289
void setGridIndex(const int in_grid_i, const int in_grid_j, const int in_grid_k, const bool setValid=false)
Set grid indices This index represent the position in a cartesian grid. It can not be automatically m...
Definition: Coords.cc:558
Spherical law of cosine (See http://www.movable-type.co.uk/scripts/latlong.html)
Definition: Coords.h:85
void setProj(const std::string &in_coordinatesystem, const std::string &in_parameters="")
Set projection to use This projection will be used for converting between lat/lon and East/North (see...
Definition: Coords.cc:590
Compact representation only containing the X/Y and I/J coordinates.
Definition: Coords.h:95
double distance(const Coords &destination) const
Calculate the distance between two points.
Definition: Coords.cc:718
double getLat() const
Definition: Coords.h:119
void setDistances(const geo_distances in_algo)
Set the algorithm to use to compute distances Various algorithm exist that offer various precision/co...
Definition: Coords.cc:663
void setLatLon(const double in_latitude, const double in_longitude, const double in_altitude, const bool in_update=true)
Set latitude and longitude The automatic update of the easting/northing can be turned off so that bot...
Definition: Coords.cc:497
void setAltitude(const double in_altitude, const bool in_update=true)
Set altitude at a given value. If the i,j,k indices were set, reset them to inodata, except if specified otherwise with in_update=false.
Definition: Coords.cc:576
int getGridI() const
Definition: Coords.h:122
bool operator!=(const Coords &) const
Operator that tests for inequality.
Definition: Coords.cc:107
void moveByXY(const double &x_displacement, const double &y_displacement)
move the point by the specified bearing and distance (in m)
Definition: Coords.cc:143
friend std::ostream & operator<<(std::ostream &os, const Coords &coord)
Definition: Coords.cc:265
void setEPSG(const int &epsg)
set the current projection to a given EPSG-defined projection
Definition: Coords.cc:778
geo_distances
Keywords for selecting the algorithm for computing geodesic distances.
Definition: Coords.h:84
bool indexIsValid() const
Returns true if the (i,j,k) index are valid.
Definition: Coords.h:125
Coords & operator=(const Coords &)
Assignement operator.
Definition: Coords.cc:111
Vincenty ellispoid formula (See T. Vincenty, "Closed formulas for the direct and reverse geodetic pro...
Definition: Coords.h:86
Simplified cartesian, only easting/northing.
Definition: Coords.h:94
int getGridK() const
Definition: Coords.h:124
double getLon() const
Definition: Coords.h:120
void moveByBearing(const double &i_bearing, const double &i_distance)
Definition: Coords.cc:148
bool isSameProj(const Coords &target) const
Check if two Coords object are using the same projection.
Definition: Coords.cc:729
bool operator==(const Coords &) const
Operator that tests for equality.
Definition: Coords.cc:74
Provide all the usually necessary information.
Definition: Coords.h:92
void copyProj(const Coords &source, const bool i_update=true)
Copy the projection parameters of another Coords object.
Definition: Coords.cc:742