-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add +proj=colombia_urban projection, implementing a EPSG projection m…
…ethod used by a number of projected CRS in Colombia (fixes #589)
- Loading branch information
Showing
11 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.. _colombia_urban: | ||
|
||
******************************************************************************** | ||
Colombia Urban | ||
******************************************************************************** | ||
|
||
.. versionadded:: 7.2 | ||
|
||
+---------------------+----------------------------------------------------------+ | ||
| **Classification** | Miscellaneous | | ||
+---------------------+----------------------------------------------------------+ | ||
| **Available forms** | Forward and inverse ellipsoidal projection | | ||
+---------------------+----------------------------------------------------------+ | ||
| **Alias** | colombia_urban | | ||
+---------------------+----------------------------------------------------------+ | ||
| **Domain** | 2D | | ||
+---------------------+----------------------------------------------------------+ | ||
| **Input type** | Geodetic coordinates | | ||
+---------------------+----------------------------------------------------------+ | ||
| **Output type** | Projected coordinates | | ||
+---------------------+----------------------------------------------------------+ | ||
|
||
From :cite:`IOGP2018`: | ||
|
||
The capital cites of each department in Colombia use an urban projection for large | ||
scale topographic mapping of the urban areas. It is based on a plane through | ||
the origin at an average height for the area, eliminating the need for corrections | ||
to engineering survey observations. | ||
|
||
proj-string: ``+proj=colombia_urban`` | ||
|
||
Parameters | ||
################################################################################ | ||
|
||
.. include:: ../options/lon_0.rst | ||
|
||
.. include:: ../options/lat_0.rst | ||
|
||
.. include:: ../options/ellps.rst | ||
|
||
.. include:: ../options/x_0.rst | ||
|
||
.. include:: ../options/y_0.rst | ||
|
||
.. option:: +h_0=<value> | ||
|
||
Projection plane origin height (in metre) | ||
|
||
*Defaults to 0.0.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#define PJ_LIB__ | ||
|
||
#include <errno.h> | ||
#include <math.h> | ||
|
||
#include "proj.h" | ||
#include "proj_internal.h" | ||
|
||
PROJ_HEAD(colombia_urban, "Colombia Urban") | ||
"\n\tMisc\n\th_0="; | ||
|
||
// Notations and formulas taken from IOGP Publication 373-7-2 - | ||
// Geomatics Guidance Note number 7, part 2 - March 2020 | ||
|
||
namespace { // anonymous namespace | ||
|
||
struct pj_opaque { | ||
double h0; // height of projection origin, divided by semi-major axis (a) | ||
double rho0; // adimensional value, contrary to Guidance note 7.2 | ||
double A; | ||
double B; // adimensional value, contrary to Guidance note 7.2 | ||
double C; | ||
double D; // adimensional value, contrary to Guidance note 7.2 | ||
}; | ||
} // anonymous namespace | ||
|
||
static PJ_XY colombia_urban_forward (PJ_LP lp, PJ *P) { | ||
PJ_XY xy; | ||
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); | ||
|
||
const double cosphi = cos(lp.phi); | ||
const double sinphi = sin(lp.phi); | ||
const double nu = 1. / sqrt(1 - P->es * sinphi * sinphi); | ||
const double lam_nu_cosphi = lp.lam * nu * cosphi; | ||
xy.x = Q->A * lam_nu_cosphi; | ||
const double sinphi_m = sin(0.5 * (lp.phi + P->phi0)); | ||
const double rho_m = (1 - P->es) / pow(1 - P->es * sinphi_m * sinphi_m, 1.5); | ||
const double G = 1 + Q->h0 / rho_m; | ||
xy.y = G * Q->rho0 * ((lp.phi - P->phi0) + Q->B * lam_nu_cosphi * lam_nu_cosphi); | ||
|
||
return xy; | ||
} | ||
|
||
static PJ_LP colombia_urban_inverse (PJ_XY xy, PJ *P) { | ||
PJ_LP lp; | ||
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); | ||
|
||
lp.phi = P->phi0 + xy.y / Q->D - Q->B * (xy.x / Q->C) * (xy.x / Q->C); | ||
const double sinphi = sin(lp.phi); | ||
const double nu = 1. / sqrt(1 - P->es * sinphi * sinphi); | ||
lp.lam = xy.x / (Q->C * nu * cos(lp.phi)); | ||
|
||
return lp; | ||
} | ||
|
||
PJ *PROJECTION(colombia_urban) { | ||
struct pj_opaque *Q = static_cast<struct pj_opaque*>(pj_calloc (1, sizeof (struct pj_opaque))); | ||
if (nullptr==Q) | ||
return pj_default_destructor (P, ENOMEM); | ||
P->opaque = Q; | ||
|
||
const double h0_unscaled = pj_param(P->ctx, P->params, "dh_0").f; | ||
Q->h0 = h0_unscaled / P->a; | ||
const double sinphi0 = sin(P->phi0); | ||
const double nu0 = 1. / sqrt(1 - P->es * sinphi0 * sinphi0); | ||
Q->A = 1 + Q->h0 / nu0; | ||
Q->rho0 = (1 - P->es) / pow(1 - P->es * sinphi0 * sinphi0, 1.5); | ||
Q->B = tan(P->phi0) / (2 * Q->rho0 * nu0); | ||
Q->C = 1 + Q->h0; | ||
Q->D = Q->rho0 * (1 + Q->h0 / (1 - P->es)); | ||
|
||
P->fwd = colombia_urban_forward; | ||
P->inv = colombia_urban_inverse; | ||
|
||
return P; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters