diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | docs/source/apps/cs2cs.rst | 2 | ||||
| -rw-r--r-- | docs/source/development/reference/functions.rst | 28 | ||||
| -rw-r--r-- | docs/source/operations/conversions/unitconvert.rst | 2 | ||||
| -rw-r--r-- | docs/source/operations/projections/tmerc.rst | 4 | ||||
| -rw-r--r-- | src/PJ_krovak.c | 20 |
6 files changed, 41 insertions, 17 deletions
@@ -4,7 +4,7 @@ [](https://ci.appveyor.com/project/OSGeo/proj-4) [](https://coveralls.io/github/OSGeo/proj.4?branch=master) [](https://gitter.im/OSGeo/proj.4) -[](http://lists.maptools.org/mailman/listinfo/proj) +[](http://lists.maptools.org/mailman/listinfo/proj) PROJ is a generic coordinate transformation software, that transforms coordinates from one coordinate reference system (CRS) to another. diff --git a/docs/source/apps/cs2cs.rst b/docs/source/apps/cs2cs.rst index f17b74ed..83b924a8 100644 --- a/docs/source/apps/cs2cs.rst +++ b/docs/source/apps/cs2cs.rst @@ -171,7 +171,7 @@ The x-y output data will appear as three lines of: :: - 1402285.99 5076292.42 0.000 + 1402285.98 5076292.42 -0.00 .. only:: man diff --git a/docs/source/development/reference/functions.rst b/docs/source/development/reference/functions.rst index e6a54cba..5e7b6266 100644 --- a/docs/source/development/reference/functions.rst +++ b/docs/source/development/reference/functions.rst @@ -32,6 +32,10 @@ Transformation setup PJ *P = proj_create(0, "+proj=etmerc +lat_0=38 +lon_0=125 +ellps=bessel"); + If creation of the transformation object fails, the function returns `0` and + the PROJ error number is updated. The error number can be read with + :c:func:`proj_errno` or :c:func:`proj_context_errno`. + The returned :c:type:`PJ`-pointer should be deallocated with :c:func:`proj_destroy`. :param PJ_CONTEXT* ctx: Threading context. @@ -51,6 +55,10 @@ Transformation setup char *args[3] = {"proj=utm", "zone=32", "ellps=GRS80"}; PJ* P = proj_create_argv(0, 3, args); + If creation of the transformation object fails, the function returns `0` and + the PROJ error number is updated. The error number can be read with + :c:func:`proj_errno` or :c:func:`proj_context_errno`. + The returned :c:type:`PJ`-pointer should be deallocated with :c:func:`proj_destroy`. :param PJ_CONTEXT* ctx: Threading context @@ -81,6 +89,11 @@ Transformation setup PJ *P = proj_create_crs_to_crs(0, "epsg:25832", "epsg:25833", 0); + If creation of the transformation object fails, the function returns `0` and + the PROJ error number is updated. The error number can be read with + :c:func:`proj_errno` or :c:func:`proj_context_errno`. + + The returned :c:type:`PJ`-pointer should be deallocated with :c:func:`proj_destroy`. :param PJ_CONTEXT* ctx: Threading context. @@ -212,12 +225,25 @@ Error reporting Get a reading of the current error-state of :c:data:`P`. An non-zero error codes indicates an error either with the transformation setup or during a - transformation. + transformation. In cases :c:data:`P` is `0` the error number of the default + context is read. A text representation of the error number can be retrieved + with :c:func:`proj_errno_string`. :param: PJ* P: Transformation object. :returns: :c:type:`int` +.. c:function:: int proj_context_errno(PJ_CONTEXT *ctx) + + Get a reading of the current error-state of :c:data:`ctx`. An non-zero error + codes indicates an error either with the transformation setup or during a + transformation. A text representation of the error number can be retrieved + with :c:func:`proj_errno_string`. + + :param: PJ_CONTEXT* ctx: threading context. + + :returns: :c:type:`int` + .. c:function:: void proj_errno_set(PJ *P, int err) Change the error-state of :c:data:`P` to `err`. diff --git a/docs/source/operations/conversions/unitconvert.rst b/docs/source/operations/conversions/unitconvert.rst index fab8026f..632f6aeb 100644 --- a/docs/source/operations/conversions/unitconvert.rst +++ b/docs/source/operations/conversions/unitconvert.rst @@ -27,7 +27,7 @@ Many North American systems are defined with coordinates in feet. For example in Vermont:: +proj=pipeline - +step +proj=tmerc +lat_0=42.5 +lon_0=-72.5 +k=0.999964286 +x_0=500000.00001016 +y_0=0 + +step +proj=tmerc +lat_0=42.5 +lon_0=-72.5 +k_0=0.999964286 +x_0=500000.00001016 +y_0=0 +step +proj=unitconvert +xy_in=m +xy_out=us-ft Often when working with GNSS data the timestamps are presented in GPS-weeks, diff --git a/docs/source/operations/projections/tmerc.rst b/docs/source/operations/projections/tmerc.rst index cd864d13..1a48fec6 100644 --- a/docs/source/operations/projections/tmerc.rst +++ b/docs/source/operations/projections/tmerc.rst @@ -59,12 +59,12 @@ The following table gives special cases of the Transverse Mercator projection. Example using Gauss-Kruger on Germany area (aka EPSG:31467) :: - $ echo 9 51 | proj +proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs + $ echo 9 51 | proj +proj=tmerc +lat_0=0 +lon_0=9 +k_0=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs 3500000.00 5651505.56 Example using Gauss Boaga on Italy area (EPSG:3004) :: - $ echo 15 42 | proj +proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl +units=m +no_defs + $ echo 15 42 | proj +proj=tmerc +lat_0=0 +lon_0=15 +k_0=0.9996 +x_0=2520000 +y_0=0 +ellps=intl +units=m +no_defs 2520000.00 4649858.60 Parameters diff --git a/src/PJ_krovak.c b/src/PJ_krovak.c index 9b269c88..44143e77 100644 --- a/src/PJ_krovak.c +++ b/src/PJ_krovak.c @@ -1,5 +1,5 @@ /* - * Project: PROJ.4 + * Project: PROJ * Purpose: Implementation of the krovak (Krovak) projection. * Definition: http://www.ihsenergy.com/epsg/guid7.html#1.4.3 * Author: Thomas Flemming, tf@ttqv.com @@ -51,7 +51,7 @@ * paper by Veverka. * * According to EPSG the full Krovak projection method should have - * the following parameters. Within PROJ.4 the azimuth, and pseudo + * the following parameters. Within PROJ the azimuth, and pseudo * standard parallel are hardcoded in the algorithm and can't be * altered from outside. The others all have defaults to match the * common usage with Krovak projection. @@ -85,8 +85,6 @@ PROJ_HEAD(krovak, "Krovak") "\n\tPCyl., Ellps."; #define EPS 1e-15 -#define S45 0.785398163397448 /* 45 deg */ -#define S90 1.570796326794896 /* 90 deg */ #define UQ 1.04216856380474 /* DU(2, 59, 42, 42.69689) */ #define S0 1.37008346281555 /* Latitude of pseudo standard parallel 78deg 30'00" N */ /* Not sure at all of the appropriate number for MAX_ITER... */ @@ -110,14 +108,14 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ gfi = pow ( (1. + P->e * sin(lp.phi)) / (1. - P->e * sin(lp.phi)), Q->alpha * P->e / 2.); - u = 2. * (atan(Q->k * pow( tan(lp.phi / 2. + S45), Q->alpha) / gfi)-S45); + u = 2. * (atan(Q->k * pow( tan(lp.phi / 2. + M_PI_4), Q->alpha) / gfi)-M_PI_4); deltav = -lp.lam * Q->alpha; s = asin(cos(Q->ad) * sin(u) + sin(Q->ad) * cos(u) * cos(deltav)); d = asin(cos(u) * sin(deltav) / cos(s)); eps = Q->n * d; - rho = Q->rho0 * pow(tan(S0 / 2. + S45) , Q->n) / pow(tan(s / 2. + S45) , Q->n); + rho = Q->rho0 * pow(tan(S0 / 2. + M_PI_4) , Q->n) / pow(tan(s / 2. + M_PI_4) , Q->n); xy.y = rho * cos(eps); xy.x = rho * sin(eps); @@ -147,7 +145,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ eps = atan2(xy.y, xy.x); d = eps / sin(S0); - s = 2. * (atan( pow(Q->rho0 / rho, 1. / Q->n) * tan(S0 / 2. + S45)) - S45); + s = 2. * (atan( pow(Q->rho0 / rho, 1. / Q->n) * tan(S0 / 2. + M_PI_4)) - M_PI_4); u = asin(cos(Q->ad) * sin(s) - sin(Q->ad) * cos(s) * cos(d)); deltav = asin(cos(s) * sin(d) / cos(u)); @@ -159,9 +157,9 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ for (i = MAX_ITER; i ; --i) { lp.phi = 2. * ( atan( pow( Q->k, -1. / Q->alpha) * - pow( tan(u / 2. + S45) , 1. / Q->alpha) * + pow( tan(u / 2. + M_PI_4) , 1. / Q->alpha) * pow( (1. + P->e * sin(fi1)) / (1. - P->e * sin(fi1)) , P->e / 2.) - ) - S45); + ) - M_PI_4); if (fabs(fi1 - lp.phi) < EPS) break; @@ -209,11 +207,11 @@ PJ *PROJECTION(krovak) { Q->alpha = sqrt(1. + (P->es * pow(cos(P->phi0), 4)) / (1. - P->es)); u0 = asin(sin(P->phi0) / Q->alpha); g = pow( (1. + P->e * sin(P->phi0)) / (1. - P->e * sin(P->phi0)) , Q->alpha * P->e / 2. ); - Q->k = tan( u0 / 2. + S45) / pow (tan(P->phi0 / 2. + S45) , Q->alpha) * g; + Q->k = tan( u0 / 2. + M_PI_4) / pow (tan(P->phi0 / 2. + M_PI_4) , Q->alpha) * g; n0 = sqrt(1. - P->es) / (1. - P->es * pow(sin(P->phi0), 2)); Q->n = sin(S0); Q->rho0 = P->k0 * n0 / tan(S0); - Q->ad = S90 - UQ; + Q->ad = M_PI_2 - UQ; P->inv = e_inverse; P->fwd = e_forward; |
