GeographicLib: GeographicLib::CassiniSoldner Class Reference

GeographicLib 2.5.2

Loading...
Searching...
No Matches
GeographicLib::CassiniSoldner Class Reference

Cassini-Soldner projection. More...

`#include <GeographicLib/CassiniSoldner.hpp>`

## Public Member Functions
| CassiniSoldner (const Geodesic &earth=Geodesic::WGS84())
| CassiniSoldner (real lat0, real lon0, const Geodesic &earth=Geodesic::WGS84())
void | Reset (real lat0, real lon0)
void | Forward (real lat, real lon, real &x, real &y, real &azi, real &rk) const
void | Reverse (real x, real y, real &lat, real &lon, real &azi, real &rk) const
void | Forward (real lat, real lon, real &x, real &y) const
void | Reverse (real x, real y, real &lat, real &lon) const
Inspector functions
bool | Init () const
Math::real | LatitudeOrigin () const
Math::real | LongitudeOrigin () const
Math::real | EquatorialRadius () const
Math::real | Flattening () const

## Detailed Description

Cassini-Soldner projection.

Cassini-Soldner projection centered at an arbitrary position, lat0, lon0, on the ellipsoid. This projection is a transverse cylindrical equidistant projection. The projection from (lat, lon) to easting and northing (x, y) is defined by geodesics as follows. Go north along a geodesic a distance y from the central point; then turn clockwise 90° and go a distance x along a geodesic. (Although the initial heading is north, this changes to south if the pole is crossed.) This procedure uniquely defines the reverse projection. The forward projection is constructed as follows. Find the point (lat1, lon1) on the meridian closest to (lat, lon). Here we consider the full meridian so that lon1 may be either lon0 or lon0 + 180°. x is the geodesic distance from (lat1, lon1) to (lat, lon), appropriately signed according to which side of the central meridian (lat, lon) lies. y is the shortest distance along the meridian from (lat0, lon0) to (lat1, lon1), again, appropriately signed according to the initial heading. [Note that, in the case of prolate ellipsoids, the shortest meridional path from (lat0, lon0) to (lat1, lon1) may not be the shortest path.] This procedure uniquely defines the forward projection except for a small class of points for which there may be two equally short routes for either leg of the path.

Because of the properties of geodesics, the (x, y) grid is orthogonal. The scale in the easting direction is unity. The scale, k, in the northing direction is unity on the central meridian and increases away from the central meridian. The projection routines return azi, the true bearing of the easting direction, and rk = 1/k, the reciprocal of the scale in the northing direction.

The conversions all take place using a Geodesic object (by default Geodesic::WGS84()). For more information on geodesics see Geodesics on an ellipsoid of revolution. The determination of (lat1, lon1) in the forward projection is by solving the inverse geodesic problem for (lat, lon) and its twin obtained by reflection in the meridional plane. The scale is found by determining where two neighboring geodesics intersecting the central meridian at lat1 and lat1 + dlat1 intersect and taking the ratio of the reduced lengths for the two geodesics between that point and, respectively, (lat1, lon1) and (lat, lon).

Example of use:

// Example of using the GeographicLib::CassiniSoldner class
#include <iostream>
#include <exception>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/CassiniSoldner.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
// Alternatively: const Geodesic& geod = Geodesic::WGS84();
const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
CassiniSoldner proj(lat0, lon0, geod);
{
// Sample forward calculation
double lat = 50.9, lon = 1.8; // Calais
double x, y;
proj.Forward(lat, lon, x, y);
cout << x << " " << y << "\n";
}
{
// Sample reverse calculation
double x = -38e3, y = 230e3;
double lat, lon;
proj.Reverse(x, y, lat, lon);
cout << lat << " " << lon << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
main
int main(int argc, const char *const argv[])
Definition CartConvert.cpp:28
CassiniSoldner.hpp
Header for GeographicLib::CassiniSoldner class.
Geodesic.hpp
Header for GeographicLib::Geodesic class.
GeographicLib::CassiniSoldner::CassiniSoldner
CassiniSoldner(const Geodesic &earth=Geodesic::WGS84())
Definition CassiniSoldner.cpp:16
GeographicLib::Constants::WGS84_f
static T WGS84_f()
Definition Constants.hpp:141
GeographicLib::Constants::WGS84_a
static T WGS84_a()
Definition Constants.hpp:135
GeographicLib::Geodesic
Geodesic calculations
Definition Geodesic.hpp:175
GeographicLib
Namespace for GeographicLib.
Definition Accumulator.cpp:12
std
Definition NearestNeighbor.hpp:806

GeodesicProj is a command-line utility providing access to the functionality of AzimuthalEquidistant, Gnomonic, and CassiniSoldner.

Definition at line 69 of file CassiniSoldner.hpp.

## Constructor & Destructor Documentation

## ◆ CassiniSoldner() [1/2]

GeographicLib::CassiniSoldner::CassiniSoldner | ( | const Geodesic & | earth = Geodesic::WGS84() | ) |
| explicit

Constructor for CassiniSoldner.

Parameters

  [in] | earth | the Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

This constructor makes an "uninitialized" object. Call Reset to set the central latitude and longitude, prior to calling Forward and Reverse.

Definition at line 16 of file CassiniSoldner.cpp.

## ◆ CassiniSoldner() [2/2]

GeographicLib::CassiniSoldner::CassiniSoldner | ( | real | lat0,
|  | real | lon0,
|  | const Geodesic & | earth = Geodesic::WGS84() )

Constructor for CassiniSoldner specifying a center point.

Parameters

  [in] | lat0 | latitude of center point of projection (degrees).
  [in] | lon0 | longitude of center point of projection (degrees).
  [in] | earth | the Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

lat0 should be in the range [−90°, 90°].

Definition at line 19 of file CassiniSoldner.cpp.

References Reset().

## Member Function Documentation

## ◆ Reset()

void GeographicLib::CassiniSoldner::Reset | ( | real | lat0,
|  | real | lon0 )

Set the central point of the projection

Parameters

  [in] | lat0 | latitude of center point of projection (degrees).
  [in] | lon0 | longitude of center point of projection (degrees).

lat0 should be in the range [−90°, 90°].

Definition at line 23 of file CassiniSoldner.cpp.

References GeographicLib::Geodesic::AZIMUTH, GeographicLib::Geodesic::DISTANCE, GeographicLib::Geodesic::DISTANCE_IN, GeographicLib::Geodesic::LATITUDE, LatitudeOrigin(), GeographicLib::Geodesic::LONGITUDE, GeographicLib::Math::norm(), and GeographicLib::Math::sincosd().

Referenced by CassiniSoldner().

## ◆ Forward() [1/2]

void GeographicLib::CassiniSoldner::Forward | ( | real | lat,
|  | real | lon,
|  | real & | x,
|  | real & | y,
|  | real & | azi,
|  | real & | rk ) const

Forward projection, from geographic to Cassini-Soldner.

Parameters

  [in] | lat | latitude of point (degrees).
  [in] | lon | longitude of point (degrees).
  [out] | x | easting of point (meters).
  [out] | y | northing of point (meters).
  [out] | azi | azimuth of easting direction at point (degrees).
  [out] | rk | reciprocal of azimuthal northing scale at point.

lat should be in the range [−90°, 90°]. A call to Forward followed by a call to Reverse will return the original (lat, lon) (to within roundoff). The routine does nothing if the origin has not been set.

Definition at line 34 of file CassiniSoldner.cpp.

References GeographicLib::Math::AngDiff(), GeographicLib::Math::AngNormalize(), GeographicLib::Math::degree(), GeographicLib::Geodesic::DISTANCE, GeographicLib::GeodesicLine::EquatorialAzimuth(), GeographicLib::GeodesicLine::GenPosition(), GeographicLib::Geodesic::GEODESICSCALE, Init(), LongitudeOrigin(), GeographicLib::Math::qd, and GeographicLib::Math::sincosd().

Referenced by Forward(), and main().

## ◆ Reverse() [1/2]

void GeographicLib::CassiniSoldner::Reverse | ( | real | x,
|  | real | y,
|  | real & | lat,
|  | real & | lon,
|  | real & | azi,
|  | real & | rk ) const

Reverse projection, from Cassini-Soldner to geographic.

Parameters

  [in] | x | easting of point (meters).
  [in] | y | northing of point (meters).
  [out] | lat | latitude of point (degrees).
  [out] | lon | longitude of point (degrees).
  [out] | azi | azimuth of easting direction at point (degrees).
  [out] | rk | reciprocal of azimuthal northing scale at point.

A call to Reverse followed by a call to Forward will return the original (x, y) (to within roundoff), provided that x and y are sufficiently small not to "wrap around" the earth. The routine does nothing if the origin has not been set.

Definition at line 79 of file CassiniSoldner.cpp.

References Init(), and GeographicLib::Math::qd.

Referenced by main(), and Reverse().

## ◆ Forward() [2/2]

void GeographicLib::CassiniSoldner::Forward | ( | real | lat,
|  | real | lon,
|  | real & | x,
|  | real & | y ) const
| inline

CassiniSoldner::Forward without returning the azimuth and scale.

Definition at line 152 of file CassiniSoldner.hpp.

References Forward().

## ◆ Reverse() [2/2]

void GeographicLib::CassiniSoldner::Reverse | ( | real | x,
|  | real | y,
|  | real & | lat,
|  | real & | lon ) const
| inline

CassiniSoldner::Reverse without returning the azimuth and scale.

Definition at line 161 of file CassiniSoldner.hpp.

References Reverse().

## ◆ Init()

bool GeographicLib::CassiniSoldner::Init | ( |  | ) | const
| inline

Returns
  true if the object has been initialized.

Definition at line 173 of file CassiniSoldner.hpp.

Referenced by Forward(), and Reverse().

## ◆ LatitudeOrigin()

Math::real GeographicLib::CassiniSoldner::LatitudeOrigin | ( |  | ) | const
| inline

Returns
  lat0 the latitude of origin (degrees).

Definition at line 178 of file CassiniSoldner.hpp.

Referenced by Reset().

## ◆ LongitudeOrigin()

Math::real GeographicLib::CassiniSoldner::LongitudeOrigin | ( |  | ) | const
| inline

Returns
  lon0 the longitude of origin (degrees).

Definition at line 184 of file CassiniSoldner.hpp.

Referenced by Forward().

## ◆ EquatorialRadius()

Math::real GeographicLib::CassiniSoldner::EquatorialRadius | ( |  | ) | const
| inline

Returns
  a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 191 of file CassiniSoldner.hpp.

## ◆ Flattening()

Math::real GeographicLib::CassiniSoldner::Flattening | ( |  | ) | const
| inline

Returns
  f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 197 of file CassiniSoldner.hpp.

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

- CassiniSoldner.hpp
- CassiniSoldner.cpp