aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Knudsen <thokn@sdfe.dk>2018-01-05 12:03:21 +0100
committerKristian Evers <kristianevers@gmail.com>2018-01-31 16:25:32 +0100
commit90968ff934a348b02f982080f8b7ccf17e037a46 (patch)
treea8293e8215edd66a09f9f986748dfc6231cde4cc /test
parente979bce36ccd2bc52cabc0b1192bc0f8d4ed6f33 (diff)
downloadPROJ-90968ff934a348b02f982080f8b7ccf17e037a46.tar.gz
PROJ-90968ff934a348b02f982080f8b7ccf17e037a46.zip
Introduce compatibility for cs2cs-style proj-strings into the 4D API.
Parameters such as towgs84, nadgrids and geoidgrids was previously only handled by pj_transform(). This commit add a compatibility layer in proj_create() by calling the pj_cs2cs_emulation_setup() function. This function sets up a handful of predefined transformation objects on the PJ object that is being created. Each of these transformation objects are related to the cs2cs-style parameters we are trying to emulate in the 4D API. That is, if the +towgs84 parameters is used we create P->helmert with the parameters specified in +towgs84. Similarly for +axis, +nadgrids and +geoidgrids. When these transformation objects exists we use them in the prepare and finalize functions in pj_fwd/ pj_inv. If no cs2cs-style parametes are specified we skip those parts of the prepare and finalizing steps. Co-authored-by:Thomas Knudsen <thokn@sdfe.dk> Co-authored-by:Kristian Evers <kristianevers@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/gie/4D-API_cs2cs-style.gie161
-rw-r--r--test/gie/axisswap.gie11
-rw-r--r--test/gie/builtins.gie16
-rw-r--r--test/gie/more_builtins.gie10
4 files changed, 182 insertions, 16 deletions
diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie
new file mode 100644
index 00000000..853df993
--- /dev/null
+++ b/test/gie/4D-API_cs2cs-style.gie
@@ -0,0 +1,161 @@
+===============================================================================
+
+Test the 4D API handling of cs2cs style transformation options.
+
+These tests are mostly based on the same material as those in
+more_builtins.gie, since we are testing the same kinds of things,
+but provided through a different interface.
+
+===============================================================================
+
+
+<gie>
+
+-------------------------------------------------------------------------------
+Test the handling of the +towgs84 parameter
+-------------------------------------------------------------------------------
+This example is from Lotti Jivall: "Simplified transformations from
+ITRF2008/IGS08 to ETRS89 for maritime applications". The original
+XYZ data (cf. more_builtins.gie) have been transformed to LPZ using
+this command: echo x_val y_val z_val | cct -It0 proj=cart ellps=GRS80 --
+
+NOTE: Here, the ellipsoid has been swapped to WGS84, to align with
+ the WGS84 ellipsoid used in the cs2cs emulation introduced by
+ pj_cs2cs_emulation_setup()
+-------------------------------------------------------------------------------
+operation proj=latlong ellps=WGS84
+ towgs84 = 0.676780, 0.654950, -0.528270,
+ -0.022742, 0.012667, 0.022704, -0.010700
+-------------------------------------------------------------------------------
+tolerance 0.05 mm
+direction forward
+
+accept 13.4999969828397 54.9999995493206 -0.6034
+expect 13.4999906103972 54.9999957469562 -0.6374
+
+direction inverse
+
+accept 13.4999906103972 54.9999957469562 -0.6374
+expect 13.4999969828397 54.9999995493206 -0.6034
+-------------------------------------------------------------------------------
+
+
+
+-------------------------------------------------------------------------------
+This example is a random point, transformed from ED50 to ETRS89 using KMStrans2.
+
+NOTE: Signs swapped wrt. KMStrans2, which apparently uses frame rotation.
+-------------------------------------------------------------------------------
+operation proj=latlong ellps=intl
+ towgs84 = 081.07030, 089.36030, 115.75260,
+ 000.48488, 000.02436, 000.41321, 0.540645
+-------------------------------------------------------------------------------
+tolerance 0.1 mm
+# echo SWAPPED and trimmed - expect succcess
+# accept 16.819999997 55.170000002 61.0
+accept 16.82 55.17 61.0
+expect 16.8210462130 55.1705688946 29.0317
+-------------------------------------------------------------------------------
+This commented-out version of the example above was used to detect the sign
+discrepancy between KMSTrans2 and PROJ.
+-------------------------------------------------------------------------------
+operation proj=latlong ellps=intl
+ towgs84 = -081.07030, -089.36030, -115.75260,
+ -000.48488, -000.02436, -000.41321, -0.540645
+-------------------------------------------------------------------------------
+# echo NOT SWAPPED - Expect failure
+# accept 16.8210462130 55.1705688946 29.0317
+# expect 16.819999997 55.170000002 61.0
+-------------------------------------------------------------------------------
+
+
+
+-------------------------------------------------------------------------------
+operation proj=latlong nadgrids=nzgd2kgrid0005.gsb ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 1 nm
+accept 173 -45 0 0
+expect 172.999892181021551 -45.001620431954613 0 0
+direction inverse
+accept 172.999892181021551 -45.001620431954613 0 0
+expect 173 -45 0 0
+-------------------------------------------------------------------------------
+
+
+
+-------------------------------------------------------------------------------
+operation proj=latlong geoidgrids=egm96_15.gtx ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 15 cm # lax tolerance due to widespread bad egm96 file
+accept 12.5 55.5 0
+expect 12.5 55.5 -36.0213
+direction inverse
+accept 12.5 55.5 -36.0213
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+operation proj=merc geoidgrids=egm96_15.gtx ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 0.1 mm
+accept 12.5 55.5 0
+expect 1391493.63492 7424275.19462 -36.0213
+direction inverse
+accept 1391493.63492 7424275.19462 -36.0213
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+
+
+
+-------------------------------------------------------------------------------
+Same as the two above, but also do axis swapping.
+-------------------------------------------------------------------------------
+operation proj=latlong geoidgrids=egm96_15.gtx axis=neu ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file
+accept 12.5 55.5 0
+expect 55.5 12.5 -36.0213
+direction inverse
+accept 55.5 12.5 -36.0213
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+operation proj=latlong geoidgrids=egm96_15.gtx axis=dne ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file
+accept 12.5 55.5 0
+expect 36.0213 55.5 12.5
+direction inverse
+accept 36.0213 55.5 12.5
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+operation proj=merc geoidgrids=egm96_15.gtx ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 0.1 mm
+accept 12.5 55.5 0
+expect 1391493.63492 7424275.19462 -36.0213
+direction inverse
+accept 1391493.63492 7424275.19462 -36.0213
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+Some more complex axis swapping.
+-------------------------------------------------------------------------------
+operation proj=latlong geoidgrids=egm96_15.gtx axis=nue ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 15 cm # lax tolerance due to widely distributed, bad egm96 file
+accept 12.5 55.5 0
+expect 55.5 -36.0213 12.5
+direction inverse
+accept 55.5 -36.0213 12.5
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+operation proj=merc geoidgrids=egm96_15.gtx axis=sue ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 15 cm
+accept 12.5 55.5 0
+expect -7424275.1946 -36.0213 1391493.6349 0.0000
+direction inverse
+accept -7424275.1946 -36.0213 1391493.6349 0.0000
+expect 12.5 55.5 0
+-------------------------------------------------------------------------------
+</gie>
diff --git a/test/gie/axisswap.gie b/test/gie/axisswap.gie
index ac148a92..190ca3e7 100644
--- a/test/gie/axisswap.gie
+++ b/test/gie/axisswap.gie
@@ -53,9 +53,14 @@ expect 3 -2 1 4
roundtrip 100
operation proj=axisswap axis=neu
-tolerance 0.000001 m
-accept 1 2 3 4
-expect 2 1 3 4
+tolerance 0 m
+accept 1 2 3
+expect 2 1 3
+
+operation proj=axisswap axis=nue
+tolerance 0 m
+accept 1 2 3
+expect 2 3 1
operation proj=axisswap axis=swd
tolerance 0.000001 m
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 3877b58a..e8f1bfe1 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -1233,14 +1233,14 @@ Geocentric
operation +proj=geocent +ellps=GRS80 +lat_1=0.5 +lat_2=2
-------------------------------------------------------------------------------
tolerance 0.00010 mm
-accept 2 1
-expect 222638.981586547 111319.490793274
-accept 2 -1
-expect 222638.981586547 -111319.490793274
-accept -2 1
-expect -222638.981586547 111319.490793274
-accept -2 -1
-expect -222638.981586547 -111319.490793274
+accept 2 1 0
+expect 6373287.27950247 222560.09599219 110568.77482092
+accept 2 -1 0
+expect 6373287.27950247 222560.09599219 -110568.77482092
+accept -2 1 0
+expect 6373287.27950247 -222560.09599219 110568.77482092
+accept -2 -1 0
+expect 6373287.27950247 -222560.09599219 -110568.77482092
direction inverse
accept 200 100
diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie
index 20bffbd9..e21f0321 100644
--- a/test/gie/more_builtins.gie
+++ b/test/gie/more_builtins.gie
@@ -131,11 +131,11 @@ expect 12 55 0 0
-------------------------------------------------------------------------------
Finally test a pipeline with more than one init step
-------------------------------------------------------------------------------
-operation proj=pipeline step
- init=epsg:25832 inv step
- init=epsg:25833 step
- init=epsg:25833 inv step
- init=epsg:25832
+operation proj=pipeline
+ step init=epsg:25832 inv
+ step init=epsg:25833
+ step init=epsg:25833 inv
+ step init=epsg:25832
-------------------------------------------------------------------------------
accept 691875.63214 6098907.82501 0 0
expect 691875.63214 6098907.82501 0 0