aboutsummaryrefslogtreecommitdiff
path: root/test/gie
AgeCommit message (Collapse)Author
2022-02-04Set more precise error code for parsing errors in proj_create().Brendan Jurd
If proj_create() catches a ParsingException, and the error code hasn't otherwise been set internally, set the error code to PROJ_ERR_INVALID_OP_WRONG_SYNTAX instead of allowing it to default to the generic PROJ_ERR_OTHER. Ref #2529
2022-01-31Drop autotools; move remaining useful m4 macros (#3027)Mike Taves
2022-01-09peirce_q: add inversion of +shape=square and diamond through generic ↵Even Rouault
inversion method
2022-01-07peirce_q: rename +type parameter wrongly introduced in 8.2.1 to +shape ↵Even Rouault
(fixes #3011)
2021-12-20Fix and additional options for Peirce Quincuncial projections (#2978)Toby C. Wilkinson
This fixes the current forward implementation of Peirce Quincuncial proj to correctly flip/reflect out the southern hemisphere to four triangles, and rotate entire result to a square or diamond. (It there resolves the issues identified with pull request https://github.com/OSGeo/PROJ/pull/2230 , where southern hemisphere was wrongly projected over northern, and reverses the restriction to northern hemisphere introduced there). It also adds additional lateral projection of the hemispheres. - This PR adds an optional parameter `+type` which allows selection of projection. The `+type=square` and `+type=diamond` types match in principle ESRI's twin implementations of square and diamond PQ projs. The **default** if not specified is `+type=diamond`. - The previous behaviour restricted to the northern hemisphere can be reproduced using the `+type=nhemisphere`, though this is an edge case only. - An additional `+type=horizontal` and `+type=vertical` rectangular lateral versions have been added that place each hemisphere side-by-side. This is primarily to allow creation of projections such as Greiger Triptychial, which also require the additional optional params `scrollx` or `scrolly` in order to shift parts of the projection from one side of the map to the other. - Additional documentation has been added to proj description, including quoting the usual meridian used in common usage of projection, and images showing the different types.
2021-11-24Pipeline parsing: reject proj=/o_proj= before first step, to avoid bad ↵Even Rouault
performance pattern on hostile pipelines Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41290
2021-10-21Add fallback_strategy to tinshift transformJohannes Schauer Marin Rodrigues
- this bumps format_version of tinshift JSON to 1.1 for the new field fallback_strategy - the default behaviour without that field is retained - if fallback_strategy is set to "nearest_side", then points that do not fall into any of the triangles will be transformed according to the nearest triangle - if fallback_centroid is set to "nearest_side", then points that do not fall into any of the triangles will be transformed according to the triangle with the nearest centroid
2021-09-15Inverse ortho ellipsoidal oblique: address a few remarks from ↵Even Rouault
https://github.com/OSGeo/PROJ/issues/2844#issuecomment-920138371
2021-09-15Inverse ellipsoidal orthographic projection (oblique case): fix convergence ↵Even Rouault
at pole
2021-09-15Fix error in implementation of Inverse ellipsoidal orthographic projection ↵Even Rouault
(oblique case) that cause convergence to sometimes fail (fixes #2844)
2021-08-16test: more testing of Polar Stereographic variantsEven Rouault
2021-08-13Inverse laea ellipsoidal: return ↵Even Rouault
PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN when appropriates (fixes OSGeo/gdal#4224)
2021-07-13Add S2 projection (#2749)marcus-elia
2021-04-30test/gie/Makefile.am: add nkg.gieEven Rouault
2021-04-30nkg.gie: fix operation line. The repetition of operation worked previously ↵Even Rouault
by accident and wasn't necessary
2021-04-15utm: error out when value of +zone= is not an integer (fixes #2671)Even Rouault
2021-04-03cass: add +hyperbolic switch for variant used by EPSG:3139 'Vanua Levu 1915 ↵Even Rouault
/ Vanua Levu Grid'
2021-04-03cass: rewrite ellipsoidal formulas in a clearer way using EPSG guidance note ↵Even Rouault
names
2021-03-11Database: Additions to the norwegian NKG2020 transformation (#2548)Sveinung Himle
* Correction grid NKG:ETRF14 to EPSG:7922 * Added NKG:ITRF_TO_NO GIE test * Correction grid no_kv_NKGETRF14_EPSG7922_2000 added to grid_alternatives.sql * proj_method 'velocity_grid' added in check_grid_alternatives_proj_method. NKG velocity grid added to grid_alternatives.sql Co-authored-by: Even Rouault <even.rouault@spatialys.com>
2021-03-07typo fixesEven Rouault
2020-12-21Implementing the NKG transformations in proj.dbKristian Evers
This adds the NKG 2008 and 2020 transformations to proj.db. The NKG transformations offers transformations between global reference frames and the national realisations of ETRS89 in Denmark, Estonia, Finland, Latvia, Lithuania, Norway and Sweden. The 2008 transformations are already implemented in the NKG 2008 file but will now be more accessible with the modern API. The 2020 transformations are new to PROJ and offers and updated version of the 2008 transformations using a new and improved deformation model (eu_nkg_nkgrf17vel.tif). A 2020 version of the NKG transformations are currently not available for Norway but will in all likelyhood be included at a later point in time.
2020-12-15Revise error codes to have a reduced set exposed in the public API.Even Rouault
Fixes #2482 And also add proj_context_errno_string() Revise gie 'expect failure errno XXXX' strings
2020-12-02Merge pull request #2444 from rouault/topocentricEven Rouault
Add +proj=topocentric geocentric->topocentric conversion (fixes #500)
2020-11-29Spherical tmerc forward: do not restrict to [-90,90] longitude rangeEven Rouault
The restriction was a copy&paste from the Evenden/Snyder approximate ellipsoidal implementation, but the spherical one is exact, so this restriction isn't needed. Also tune a bit the handling of lat=0, |lon| > 90
2020-11-29Inverse tmerc spherical: fix wrong sign of latitude when lat_0 is used ↵Even Rouault
(fixes #2468) Corrected formula given by @evanmiller
2020-11-23Add +proj=topocentric geocentric->topocentric conversion (fixes #500)Even Rouault
2020-11-12Polar stereographic at pole: make it return (0,0)Even Rouault
Due to the improved accuracy of pj_tsfn(), it no longer returns 0 when phi=90° due to the conversion in radians. Some GDAL tests are very sensitive to the pole transforming to (0,0) exactly, so add a special case for that. master only
2020-11-01Merge pull request #2397 from cffk/merc-updateCharles Karney
Update Mercator projection, more accurate, faster
2020-10-27Use nm units in builtins.gie. Remove backward looking comments in code.Charles Karney
2020-10-26Try to fix compiler complaints for max and constexpr sqrtCharles Karney
2020-10-26Update Mercator projectionCharles Karney
Introduction ------------ The existing formulation for the Mercator projection is "satisfactory"; it is reasonably accurate. However for a core projection like Mercator, I think we should strive for full double precision accuracy. This commit uses cleaner, more accurate, and faster methods for computing the forward and inverse projections. These use the formulation in terms of hyperbolic functions that are manifestly odd in latitude psi = asinh(tan(phi)) - e * atanh(e * sin(phi)) (phi = latitude; psi = isometric latitude = Mercator y coordinate). Contrast this with the existing formulation psi = log(tan(pi/4 - phi/2)) - e/2 * log((1 + e * sin(phi)) / (1 - e * sin(phi))) where psi(-phi) isn't exactly equal to -psi(phi) and psi(0) isn't guaranteed to be 0. Implementation -------------- There's no particular issue implementing the forward projection, just apply the formulas above. The inverse projection is tricky because there's no closed form solution for the inverse. The existing code for the inverse uses an iterative method from Snyder. This is the usual hokey function iteration, and, as usual, the convergence rate is linear (error reduced by a constant factor on each iteration). This is OK (just) for low accuracy work. But nowadays, something with quadratic convergence (e.g., Newton's method, number of correct digits doubles on each iteration) is preferred (and used here). More on this later. The solution for phi(psi) I use is described in my TM paper and I lifted the specific formulation from GeographicLib's Math::tauf, which uses the same underlying machinery for all conformal projections. It solves for tan(phi) in terms of sinh(psi) which as a near identity mapping is ideal for Newton's method. For comparison I also look at the approach adopted by Poder + Engsager in their TM paper and implemented in etmerc. This uses trigonometric series (accurate to n^6) to convert phi <-> chi. psi is then given by psi = asinh(tan(chi)) Accuracy -------- I tested just the routines for transforming phi <-> psi from merc.cpp and measured the errors (converted to true nm = nanometers) for the forward and inverse mapping. I also included in my analysis the method used by etmerc. This uses a trigonometric series to convert phi <-> chi = atan(sinh(psi)), the conformal latitude. forward inverse max rms max rms old merc 3.60 0.85 2189.47 264.81 etmerc 1.82 0.38 1.42 0.37 new merc 1.83 0.30 2.12 0.31 1 nm is pretty much the absolute limit for accuracy in double precision (1 nm = 10e6 m / 2^53, approximately), and 5 nm is probably the limit on what you should routinely expect. So the old merc inverse is considerably less accurate that it could be. The old merc forward is OK on accuracy -- except that if does not preserve the parity of the projection. The accuracy of etmerc is fine (the truncation error of the 6th order series is small compared with the round-off error). However, situation reverses as the flattening is increased. E.g., at f = 1/150, the max error for the inverse projection is 8 nm. etmerc is OK for terrestrial applications, but couldn't be used for Mars. Timing ------ Here's what I get with g++ -O3 on various Linux machines with recent versions of g++. As always, you should take these with a grain of salt. You might expect the relative timings to vary by 20% or so when switching between compilers/machines. Times per call in ns = nanoseconds. forward inverse old merc 121 360 etmerc 4e-6 1.4 new merc 20 346 The new merc method is 6 times faster at the forward projection and modestly faster at the inverse projection (despite being more accurate). The latter result is because it only take 2 iterations of Newton's method to get full accuracy compared with an average of 5 iterations for the old method to get only um accuracy. A shocking aspect of these timings is how fast etmerc is. Another is that forward etmerc is streaks faster that inverse etmerc (it made be doubt my timing code). Evidently, asinh(tan(chi)) is a lot faster to compute than atan(sinh(psi)). The hesitation about adopting etmerc then comes down to: * the likelihood that Mercator may be used for non-terrestrial bodies; * the question of whether the timing benefits for the etmerc method would be noticeable in a realistic application; * need to duplicate the machinery for evaluating the coefficients for the series and for Clenshaw summation in the current code layout. Ripple effects ============== The Mercator routines used the the Snyder method, pj_tsfn and pj_phi2, are used in other projections. These relate phi to t = exp(-psi) (a rather bizarre choice in my book). I've retrofitted these to use the more accurate methods. These do the "right thing" for phi in [-pi/2, pi/2] , t in [0, inf], and e in [0, 1). NANs are properly handled. Of course, phi = pi/2 in double precision is actually less than pi/2, so cos(pi/2) > 0. So no special handling is needed for pi/2. Even if angles were handled in such a way that 90deg were exactly represented, these routines would still "work", with, e.g., tan(pi/2) -> inf. (A caution: with long doubles = a 64-bit fraction, we have cos(pi/2) < 0; and now we would need to be careful.) As a consequence, there no need for error handling in pj_tsfn; the HUGE_VAL return has gone and, of course, HUGE_VAL is a perfectly legal input to tsfn's inverse, phi2, which would return -pi/2. This "error handling" was only needed for e = 1, a case which is filtered out upstream. I will note that bad argument handling is much more natural using NAN instead of HUGE_VAL. See issue #2376 I've renamed the error condition for non-convergence of the inverse projection from "non-convergent inverse phi2" to "non-convergent sinh(psi) to tan(phi)". Now that pj_tsfn and pj_phi2 now return "better" results, there were some malfunctions in the projections that called them, specifically gstmerc, lcc, and tobmerc. * gstmerc invoked pj_tsfn(phi, sinphi, e) with a value of sinphi that wasn't equal to sin(phi). Disaster followed. I fixed this. I also replaced numerous occurrences of "-1.0 * x" by "-x". (Defining a function with arguments phi and sinphi is asking for trouble.) * lcc incorrectly thinks that the projection isn't defined for standard latitude = +/- 90d. This happens to be false (it reduces to polar stereographic in this limit). The check was whether tsfn(phi) = 0 (which only tested for the north pole not the south pole). However since tsfn(pi/2) now (correctly) returns a nonzero result, this test fails. I now just test for |phi| = pi/2. This is clearer and catches both poles (I'm assuming that the current implementation will probably fail in these cases). * tobmerc similarly thinks that phi close to +/- pi/2 can't be transformed even though psi(pi/2) is only 38. I'm disincline to fight this. However I did tighten up the failure condition (strict equality of |phi| == pi/2). OTHER STUFF =========== Testing ------- builtins.gei: I tightened up the tests for merc (and while I was about it etmerc and tmerc) to reflect full double precision accuracy. My test values are generated with MPFR enabled code and so should be accurate to all digits given. For the record, for GRS80 I use f = 1/298.2572221008827112431628366 in these calculations. pj_phi2_test: many of the tests were bogus testing irrelevant input parameters, like negative values of exp(-psi), and freezing in the arbitrary behavior of phi2. I've reworked most for the tests to be semi-useful. @schwehr can you review. Documentation ------------- I've updated merc.rst to outline the calculation of the inverse projection. phi2.cpp includes detailed notes about applying Newton's method to find tan(phi) in terms of sinh(psi). Future work ----------- lcc needs some tender loving care. It can easily (and should) be modified to allow stdlat = +/- 90 (reduces to polar stereographic), stdlat = 0 and stdlat_1 + stdlat_2 = 0 (reduces to Mercator). A little more elbow grease will allow the treatment of stdlat_1 close to stdlat_2 using divided differences. (See my implementation of the LambertConformalConic class in GeographicLib.) All the places where pj_tsfn and pj_phi2 are called need to be reworked to cut out the use of Snyder's t = exp(-psi() variable and instead use sinh(psi). Maybe include the machinery for series conversions between all auxiliary latitudes as "support functions". Then etmerc could use this (as could mlfn for computing meridional distance). merc could offer the etmerc style projection via chi as an option when the flattening is sufficiently small.
2020-10-25Add +proj=col_urban projection, implementing a EPSG projection method used ↵Even Rouault
by a number of projected CRS in Colombia (fixes #589)
2020-10-25Fix typos spotted by scripts/fix_typos.shEven Rouault
2020-09-30Merge pull request #2361 from rouault/ortho_ellipsoidalEven Rouault
Implement ellipsoidal formulation of +proj=ortho (fixes #397)
2020-09-30Add a +proj=tinshift for triangulation-based transformationsEven Rouault
Implements RFC-6
2020-09-27Ortho ellipsoidal inverse: improve accuracy in polar case with (x,y) close ↵Even Rouault
to (0,0)
2020-09-27Ortho ellipsoidal inverse: add domain check for oblique case, and slighly ↵Even Rouault
improve initial guessing
2020-09-26Ortho ellipsoidal inverse: add non iterative implementations for polar and ↵Even Rouault
equatorial
2020-09-26Ortho: add visibility condition for ellipsoidal case. Credits to @cffkEven Rouault
2020-09-26Implement ellipsoidal formulation of +proj=ortho (fixes #397)Even Rouault
- Map ESRI 'Local' to +proj=ortho when Scale_Factor = 1 and Azimuth = 0 - Map ESRI 'Orthographic' to a PROJ WKT2 'Orthographic (Spherical)' which maps to +proj=ortho +f=0 to froce spherical evaluation
2020-08-21Helmert: fix regression when rotation terms are 0, but scale is notEven Rouault
Fixes #2333 Was due to 3dc92ad7014e1cf20a3bc95c8c21a34a371fcb78 Doesn't affect released versions
2020-07-24Helmert 2D: do not require a useless convention= parameterEven Rouault
2020-05-28Implement wink2 inverse by generic inversion of forward methodEven Rouault
- Move the generic method initiated from adams_ws2 to a pj_generic_inverse_2d() method - Use it in adams_ws2 - Use it in wink2 Fixes https://github.com/qgis/QGIS/issues/35512
2020-05-24Merge pull request #2230 from rouault/limit_peirce_q_to_northern_hemisphereEven Rouault
Limit peirce_q to northern hemisphere, and fix images for adams_hemi, guyou and peirce_q
2020-05-19Zone Definition Fixes for igh_o projection (#2233)John Krasting
- Central lon for zone 2 should be -d10, not d10 - Extra lobe was missing for zone 11 - New figure generated - New test suite values generated
2020-05-19Implemented IGH Oceanic View (#2226)John Krasting
- The current implementation of the Interrupted Goode Homolosine projection emphasizes land area. This is a compliment projection that emphasizes ocean area. - A value of lon0=-160 produces a reasonable real-world map.
2020-05-17Merge pull request #2206 from rouault/deformation_model_for_mergeEven Rouault
Add a +proj=defmodel transformation for multi-component time-based deformation models
2020-05-16Add a +proj=defmodel transformation for multi-component time-based ↵Even Rouault
deformation models Fixes #1001 Co-authored-by: Chris Crook <ccrook@linz.govt.nz>
2020-05-16peirce_q: limit input to positive latitudesEven Rouault
Otherwise it returns junk (negative latitudes are mapped to the same location as positive latitudes) I'm a bit confused by PROJ peirce_q implementation. Looking at the projection of the world, it looks like this matches the diamond formulation of the right map shown at https://desktop.arcgis.com/en/arcmap/latest/map/projections/peirce-quincuncial.htm, but limited to the inner square of this diamond (which corresponds to the northern hemisphere). We lack the 4 triangles on left, top, right and bottom for the southern hemisphere. Furthermore, this formulation of peirce_q does not seem to have the quincuncial property of the square formulation (left images of the above ESRI doc), or the one at https://en.wikipedia.org/wiki/Peirce_quincuncial_projection ...
2020-05-09scripts/fix_typos.sh: fix URLs to dictionaries, and fix typos spottedEven Rouault