@@ -66,74 +66,91 @@ def testOperations(self):
66
66
# uses a grid file
67
67
ops = QgsDatumTransform .operations (QgsCoordinateReferenceSystem ('EPSG:4283' ),
68
68
QgsCoordinateReferenceSystem ('EPSG:7844' ))
69
- self .assertEqual (len (ops ), 5 )
70
- self .assertTrue (ops [0 ].name )
71
- self .assertEqual (ops [0 ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
72
- self .assertTrue (ops [0 ].isAvailable )
73
- self .assertEqual (ops [0 ].accuracy , 0.01 )
74
- self .assertEqual (len (ops [0 ].grids ), 0 )
75
- self .assertTrue (ops [1 ].name )
76
- self .assertEqual (ops [1 ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
77
- self .assertEqual (ops [1 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
78
- self .assertEqual (len (ops [1 ].grids ), 1 )
79
- self .assertEqual (ops [1 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_and_distortion.gsb' )
80
- self .assertEqual (ops [1 ].grids [0 ].fullName , '' )
81
- self .assertEqual (ops [1 ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
82
- self .assertEqual (ops [1 ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
83
- self .assertTrue (ops [1 ].grids [0 ].directDownload )
84
- self .assertTrue (ops [1 ].grids [0 ].openLicense )
85
- self .assertTrue (ops [2 ].name )
86
- self .assertEqual (ops [2 ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
87
- self .assertEqual (ops [2 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
88
- self .assertEqual (len (ops [2 ].grids ), 1 )
89
- self .assertEqual (ops [2 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal.gsb' )
90
- self .assertEqual (ops [2 ].grids [0 ].fullName , '' )
91
- self .assertEqual (ops [2 ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
92
- self .assertEqual (ops [2 ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
93
- self .assertTrue (ops [2 ].grids [0 ].directDownload )
94
- self .assertTrue (ops [2 ].grids [0 ].openLicense )
95
- self .assertTrue (ops [3 ].name )
96
- self .assertEqual (ops [3 ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
97
- self .assertEqual (ops [3 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
98
- self .assertEqual (len (ops [3 ].grids ), 1 )
99
- self .assertEqual (ops [3 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_cocos_island.gsb' )
100
- self .assertEqual (ops [3 ].grids [0 ].fullName , '' )
101
- self .assertTrue (ops [4 ].name )
102
- self .assertEqual (ops [4 ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
103
- self .assertEqual (ops [4 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
104
- self .assertEqual (len (ops [4 ].grids ), 1 )
105
- self .assertEqual (ops [4 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_christmas_island.gsb' )
106
- self .assertEqual (ops [4 ].grids [0 ].fullName , '' )
69
+ self .assertGreaterEqual (len (ops ), 5 )
70
+
71
+ op1_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' ][0 ]
72
+ self .assertTrue (ops [op1_index ].name )
73
+ self .assertEqual (ops [op1_index ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
74
+ self .assertTrue (ops [op1_index ].isAvailable )
75
+ self .assertEqual (ops [op1_index ].accuracy , 0.01 )
76
+ self .assertEqual (len (ops [op1_index ].grids ), 0 )
77
+
78
+ op2_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' ][0 ]
79
+ self .assertTrue (ops [op2_index ].name )
80
+ self .assertEqual (ops [op2_index ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
81
+ self .assertEqual (ops [op2_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
82
+ self .assertEqual (len (ops [op2_index ].grids ), 1 )
83
+ self .assertEqual (ops [op2_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_and_distortion.gsb' )
84
+ self .assertEqual (ops [op2_index ].grids [0 ].fullName , '' )
85
+ self .assertEqual (ops [op2_index ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
86
+ self .assertEqual (ops [op2_index ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
87
+ self .assertTrue (ops [op2_index ].grids [0 ].directDownload )
88
+ self .assertTrue (ops [op2_index ].grids [0 ].openLicense )
89
+
90
+ op3_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' ][0 ]
91
+ self .assertTrue (ops [op3_index ].name )
92
+ self .assertEqual (ops [op3_index ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
93
+ self .assertEqual (ops [op3_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
94
+ self .assertEqual (len (ops [op3_index ].grids ), 1 )
95
+ self .assertEqual (ops [op3_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal.gsb' )
96
+ self .assertEqual (ops [op3_index ].grids [0 ].fullName , '' )
97
+ self .assertEqual (ops [op3_index ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
98
+ self .assertEqual (ops [op3_index ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
99
+ self .assertTrue (ops [op3_index ].grids [0 ].directDownload )
100
+ self .assertTrue (ops [op3_index ].grids [0 ].openLicense )
101
+
102
+ op4_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' ][0 ]
103
+ self .assertTrue (ops [op4_index ].name )
104
+ self .assertEqual (ops [op4_index ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
105
+ self .assertEqual (ops [op4_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
106
+ self .assertEqual (len (ops [op4_index ].grids ), 1 )
107
+ self .assertEqual (ops [op4_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_cocos_island.gsb' )
108
+ self .assertEqual (ops [op4_index ].grids [0 ].fullName , '' )
109
+
110
+ op5_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' ][0 ]
111
+ self .assertTrue (ops [op5_index ].name )
112
+ self .assertEqual (ops [op5_index ].proj , '+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' )
113
+ self .assertEqual (ops [op5_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
114
+ self .assertEqual (len (ops [op5_index ].grids ), 1 )
115
+ self .assertEqual (ops [op5_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_christmas_island.gsb' )
116
+ self .assertEqual (ops [op5_index ].grids [0 ].fullName , '' )
107
117
108
118
# uses a pivot datum (technically a proj test, but this will help me sleep at night ;)
109
119
ops = QgsDatumTransform .operations (QgsCoordinateReferenceSystem ('EPSG:3111' ),
110
120
QgsCoordinateReferenceSystem ('EPSG:7899' ))
111
- self .assertEqual (len (ops ), 3 )
112
- self .assertTrue (ops [0 ].name )
113
- self .assertEqual (ops [0 ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
114
- self .assertTrue (ops [0 ].isAvailable )
115
- self .assertEqual (ops [0 ].accuracy , 0.01 )
116
- self .assertEqual (len (ops [0 ].grids ), 0 )
117
- self .assertTrue (ops [1 ].name )
118
- self .assertEqual (ops [1 ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
119
- self .assertEqual (ops [1 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
120
- self .assertEqual (len (ops [1 ].grids ), 1 )
121
- self .assertEqual (ops [1 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_and_distortion.gsb' )
122
- self .assertEqual (ops [1 ].grids [0 ].fullName , '' )
123
- self .assertEqual (ops [1 ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
124
- self .assertEqual (ops [1 ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
125
- self .assertTrue (ops [1 ].grids [0 ].directDownload )
126
- self .assertTrue (ops [1 ].grids [0 ].openLicense )
127
- self .assertTrue (ops [2 ].name )
128
- self .assertEqual (ops [2 ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
129
- self .assertEqual (ops [2 ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
130
- self .assertEqual (len (ops [2 ].grids ), 1 )
131
- self .assertEqual (ops [2 ].grids [0 ].shortName , 'GDA94_GDA2020_conformal.gsb' )
132
- self .assertEqual (ops [2 ].grids [0 ].fullName , '' )
133
- self .assertEqual (ops [2 ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
134
- self .assertEqual (ops [2 ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
135
- self .assertTrue (ops [2 ].grids [0 ].directDownload )
136
- self .assertTrue (ops [2 ].grids [0 ].openLicense )
121
+
122
+ self .assertGreaterEqual (len (ops ), 3 )
123
+
124
+ op1_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' ][0 ]
125
+ self .assertTrue (ops [op1_index ].name )
126
+ self .assertEqual (ops [op1_index ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
127
+ self .assertTrue (ops [op1_index ].isAvailable )
128
+ self .assertEqual (ops [op1_index ].accuracy , 0.01 )
129
+ self .assertEqual (len (ops [op1_index ].grids ), 0 )
130
+
131
+ op2_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' ][0 ]
132
+ self .assertTrue (ops [op2_index ].name )
133
+ self .assertEqual (ops [op2_index ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
134
+ self .assertEqual (ops [op2_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
135
+ self .assertEqual (len (ops [op2_index ].grids ), 1 )
136
+ self .assertEqual (ops [op2_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal_and_distortion.gsb' )
137
+ self .assertEqual (ops [op2_index ].grids [0 ].fullName , '' )
138
+ self .assertEqual (ops [op2_index ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
139
+ self .assertEqual (ops [op2_index ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
140
+ self .assertTrue (ops [op2_index ].grids [0 ].directDownload )
141
+ self .assertTrue (ops [op2_index ].grids [0 ].openLicense )
142
+
143
+ op3_index = [i for i in range (len (ops )) if ops [i ].proj == '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' ][0 ]
144
+ self .assertTrue (ops [op3_index ].name )
145
+ self .assertEqual (ops [op3_index ].proj , '+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80' )
146
+ self .assertEqual (ops [op3_index ].accuracy , 0.05 ) # actually incorrect in EPSG registry, may need updating
147
+ self .assertEqual (len (ops [op3_index ].grids ), 1 )
148
+ self .assertEqual (ops [op3_index ].grids [0 ].shortName , 'GDA94_GDA2020_conformal.gsb' )
149
+ self .assertEqual (ops [op3_index ].grids [0 ].fullName , '' )
150
+ self .assertEqual (ops [op3_index ].grids [0 ].packageName , 'proj-datumgrid-oceania' )
151
+ self .assertEqual (ops [op3_index ].grids [0 ].url , 'https://download.osgeo.org/proj/proj-datumgrid-oceania-latest.zip' )
152
+ self .assertTrue (ops [op3_index ].grids [0 ].directDownload )
153
+ self .assertTrue (ops [op3_index ].grids [0 ].openLicense )
137
154
138
155
139
156
if __name__ == '__main__' :
0 commit comments