aboutsummaryrefslogtreecommitdiff
path: root/test/gie/more_builtins.gie
blob: 2d558f889ffbe7b215fb43fd7895418b8dd5bfff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
===============================================================================

Various test material, mostly converted from selftest entries in PJ_xxx.c

Contrary to the material in builtins.gie, this material is handwritten and
intends to exercise corner cases.

===============================================================================


<gie>

-------------------------------------------------------------------------------
Two ob_tran tests from nad/testvarious
-------------------------------------------------------------------------------
operation +proj=ob_tran  +o_proj=moll  +R=6378137.0  +o_lon_p=0  +o_lat_p=0  +lon_0=180
-------------------------------------------------------------------------------
tolerance 1 mm
direction inverse

accept    300000 400000 0 0
expect    -42.7562158333  85.5911341667  0  0

direction forward

accept    10 20 0 0
expect    -1384841.18787 7581707.88240 0 0
-------------------------------------------------------------------------------





-------------------------------------------------------------------------------
Two tests from PJ_molodensky.c
-------------------------------------------------------------------------------
operation proj=molodensky a=6378160 rf=298.25
          da=-23  df=-8.120449e-8  dx=-134  dy=-48  dz=149
          abridged
-------------------------------------------------------------------------------
tolerance 2 m

accept    144.9667  -37.8      50     0
expect    144.968   -37.79848  46.378 0

roundtrip 100    1 m
-------------------------------------------------------------------------------
Same thing once more, but this time unabridged
-------------------------------------------------------------------------------
operation proj=molodensky a=6378160 rf=298.25
          da=-23  df=-8.120449e-8  dx=-134  dy=-48  dz=149
-------------------------------------------------------------------------------
tolerance 2 m

accept    144.9667  -37.8      50     0
expect    144.968   -37.79848  46.378 0

roundtrip 100    1 m
-------------------------------------------------------------------------------





-------------------------------------------------------------------------------
Some tests from PJ_pipeline.c
-------------------------------------------------------------------------------
Forward-reverse geo->utm->geo
-------------------------------------------------------------------------------
operation proj=pipeline zone=32 step
          proj=utm  ellps=GRS80 step
          proj=utm  ellps=GRS80 inv
-------------------------------------------------------------------------------
tolerance 0.1 mm

accept 12 55 0 0
expect 12 55 0 0

Now the inverse direction (still same result: the pipeline is symmetrical)

direction inverse
expect 12 55 0 0
-------------------------------------------------------------------------------
And now the back-to-back situation utm->geo->utm
-------------------------------------------------------------------------------
operation proj=pipeline zone=32 ellps=GRS80 step
          proj=utm inv                      step
          proj=utm
-------------------------------------------------------------------------------
accept 691875.63214  6098907.82501  0  0
expect 691875.63214  6098907.82501  0  0
direction inverse
expect 691875.63214  6098907.82501  0  0
-------------------------------------------------------------------------------
Test a corner case: A rather pointless one-step pipeline geo->utm
-------------------------------------------------------------------------------
operation proj=pipeline step proj=utm zone=32 ellps=GRS80
-------------------------------------------------------------------------------
accept    12 55 0 0
expect    691875.63214  6098907.82501  0  0
direction inverse
accept    691875.63214  6098907.82501  0  0
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
-------------------------------------------------------------------------------
accept    691875.63214  6098907.82501  0  0
expect    691875.63214  6098907.82501  0  0
direction inverse
accept    12 55 0 0
expect    12 55 0 0





-------------------------------------------------------------------------------
Some tests from PJ_vgridshift.c
-------------------------------------------------------------------------------
operation  proj=vgridshift  grids=egm96_15.gtx  ellps=GRS80
-------------------------------------------------------------------------------
Appears there is a difference between the egm96_15.gtx distributed by OSGeo4W,
and the one from http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx
N(12.5, 55.5) = -36.021305084228515625  (download.osgeo.org)
N(12.5, 55.5) = -35.880001068115234000  (OSGeo4W)
This is annoying, but must be handled elsewhere. We jump through the hoop by
setting a very lax tolerance.
-------------------------------------------------------------------------------
tolerance 15 cm
accept    12.5 55.5   0                  0
expect    12.5 55.5 -36.021305084228516  0

roundtrip 100 1 nm
-------------------------------------------------------------------------------
Fail on purpose: +grids parameter is mandatory
operation proj=vgridshift
expect    failure errno no_args

Fail on purpose: open non-existing grid
operation proj=vgridshift grids=nonexistinggrid.gtx
expect    failure errno failed_to_load_grid
-------------------------------------------------------------------------------





-------------------------------------------------------------------------------
Some tests from PJ_hgridshift.c
-------------------------------------------------------------------------------
operation  proj=hgridshift +grids=nzgd2kgrid0005.gsb  ellps=GRS80
-------------------------------------------------------------------------------
tolerance 1 nm
accept    173 -45 0 0
roundtrip 100
-------------------------------------------------------------------------------
expect    172.999892181021551 -45.001620431954613  0 0
direction inverse
accept    172.999892181021551 -45.001620431954613  0 0
expect    173 -45 0 0
-------------------------------------------------------------------------------

# Fail on purpose: open non-existing grid:
operation proj=hgridshift grids=@nonexistinggrid.gsb,anothernonexistinggrid.gsb
expect    failure errno failed_to_load_grid

# Fail on purpose: +grids parameter is mandatory:
operation proj=hgridshift
expect    failure errno no_args
-------------------------------------------------------------------------------




-------------------------------------------------------------------------------
A number of tests from PJ_helmert.c
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
This example is from Lotti Jivall: "Simplified transformations from
ITRF2008/IGS08 to ETRS89 for maritime applications"
-------------------------------------------------------------------------------
operation  proj=helmert ellps=GRS80
           x=0.67678    y=0.65495   z=-0.52827
           rx=-0.022742 ry=0.012667 rz=0.022704  s=-0.01070
-------------------------------------------------------------------------------
tolerance 1 um
accept     3565285.00000000  855949.00000000  5201383.00000000
expect     3565285.41342351  855948.67986759  5201382.72939791
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
This example is a random point, transformed from ED50 to ETRS89 using KMStrans2
-------------------------------------------------------------------------------
operation   proj=helmert   ellps=GRS80   exact
            x=-081.0703    rx=-0.48488
            y=-089.3603    ry=-0.02436
            z=-115.7526    rz=-0.41321   s=-0.540645
-------------------------------------------------------------------------------
tolerance  1 um
accept     3494994.30120000 1056601.97250000 5212382.16660000
expect     3494909.84026368 1056506.78938633 5212265.66699761
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
This example is a coordinate from the geodetic observatory in Onsala,
Sweden transformed from ITRF2000 @ 2017.0 to ITRF93 @ 2017.0.

The test coordinate was transformed using GNSStrans, using transformation
parameters published by ITRF: ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP
-------------------------------------------------------------------------------
operation  proj=helmert ellps=GRS80  transpose
           x =  0.0127   dx = -0.0029   rx = -0.00039  drx = -0.00011
           y =  0.0065   dy = -0.0002   ry =  0.00080  dry = -0.00019
           z = -0.0209   dz = -0.0006   rz = -0.00114  drz =  0.00007

           s =  0.00195  ds =  0.00001  t_epoch = 1988.0
-------------------------------------------------------------------------------
tolerance  0.03 mm
accept     3370658.37800 711877.31400 5349787.08600  2017.0  # ITRF2000@2017.0
expect     3370658.18890 711877.42370 5349787.12430  2017.0  # ITRF93@2017.0
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
This example is from "A mathematical relationship between NAD27 and NAD83 (91)
State Plane coordinates in Southeastern Wisconsin":
http://www.sewrpc.org/SEWRPCFiles/Publications/TechRep/tr-034-Mathematical-Relationship-Between-NAD27-and-NAD83-91-State-Plane-Coordinates-Southeastern-Wisconsin.pdf

The test data is taken from p. 29. Here we are using point 203 and converting it
from NAD27 (ft) -> NAD83 (m). The paper reports a difference of 0.0014 m from
measured to computed coordinates, hence the test tolerance is set accordingly.
-------------------------------------------------------------------------------
operation  proj=helmert ellps=GRS80
           x=-9597.3572 y=.6112
           s=0.304794780637 theta=-1.244048
-------------------------------------------------------------------------------
tolerance  1 mm
accept     2546506.957 542256.609  0
expect     766563.675  165282.277  0
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
Finally test the 4D-capabilities of the proj.h API, especially that the
rotation matrix is updated when necessary.

Test coordinates from GNSStrans.
-------------------------------------------------------------------------------
operation  proj=helmert ellps=GRS80 transpose
           x = 0.01270  dx =-0.0029  rx =-0.00039  drx =-0.00011
           y = 0.00650  dy =-0.0002  ry = 0.00080  dry =-0.00019
           z =-0.0209   dz =-0.0006  rz =-0.00114  drz = 0.00007
           s = 0.00195  ds = 0.00001
           t_epoch=1988.0
-------------------------------------------------------------------------------
tolerance  0.1 mm
accept     3370658.378    711877.314    5349787.086    2017.0
expect     3370658.18890  711877.42370  5349787.12430  2017.0
accept     3370658.378    711877.314    5349787.086    2018.0
expect     3370658.18087  711877.42750  5349787.12648  2018.0
-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
geocentric latitude
-------------------------------------------------------------------------------
operation  proj=geoc ellps=GRS80
accept     12   55                  0 0
expect     12   54.818973308324573  0 0
roundtrip  1000

accept     12   90                  0 0
expect     12   90                  0 0

accept     12  -90                  0 0
expect     12  -90                  0 0

accept     12   89.99999999999      0 0
expect     12   89.999999999989996  0 0
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
some less used options
-------------------------------------------------------------------------------
operation  proj=utm  ellps=GRS80  zone=32  to_meter=0
expect     failure   errno unit_factor_less_than_0

operation  proj=utm  ellps=GRS80  zone=32  to_meter=10
accept     12   55
expect        69187.5632    609890.7825
-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
run the few gie-builtin tests, which are currently either awkward or impossible
to express in the gie command set
-------------------------------------------------------------------------------
builtins
-------------------------------------------------------------------------------

</gie>