def testReadWriteSettingsProj6(self): context = QgsCoordinateTransformContext() context.readSettings() proj_1 = '+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=intl +step +proj=helmert +x=-18.944 +y=-379.364 +z=-24.063 +rx=-0.04 +ry=0.764 +rz=-6.431 +s=3.657 +convention=coordinate_frame +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' proj_2 = '+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=intl +step +proj=helmert +x=-150 +y=-250 +z=-1 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' # should be empty self.assertEqual(context.coordinateOperations(), {}) self.assertTrue(context.addCoordinateOperation(QgsCoordinateReferenceSystem(4204), QgsCoordinateReferenceSystem(4326), proj_1)) self.assertTrue(context.addCoordinateOperation(QgsCoordinateReferenceSystem(4205), QgsCoordinateReferenceSystem(4326), proj_2)) self.assertEqual(context.coordinateOperations(), {('EPSG:4204', 'EPSG:4326'): proj_1, ('EPSG:4205', 'EPSG:4326'): proj_2}) # save to settings context.writeSettings() # restore from settings context2 = QgsCoordinateTransformContext() self.assertEqual(context2.coordinateOperations(), {}) context2.readSettings() # check result self.assertEqual(context2.coordinateOperations(), {('EPSG:4204', 'EPSG:4326'): proj_1, ('EPSG:4205', 'EPSG:4326'): proj_2})
def testReadWriteSettingsProj6(self): context = QgsCoordinateTransformContext() context.readSettings() proj_1 = '+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=intl +step +proj=helmert +x=-18.944 +y=-379.364 +z=-24.063 +rx=-0.04 +ry=0.764 +rz=-6.431 +s=3.657 +convention=coordinate_frame +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' proj_2 = '+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=intl +step +proj=helmert +x=-150 +y=-250 +z=-1 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1' # should be empty self.assertEqual(context.coordinateOperations(), {}) self.assertTrue(context.addCoordinateOperation(QgsCoordinateReferenceSystem(4204), QgsCoordinateReferenceSystem(4326), proj_1)) self.assertTrue(context.addCoordinateOperation(QgsCoordinateReferenceSystem(4205), QgsCoordinateReferenceSystem(4326), proj_2)) self.assertEqual(context.coordinateOperations(), {('EPSG:4204', 'EPSG:4326'): proj_1, ('EPSG:4205', 'EPSG:4326'): proj_2}) # save to settings context.writeSettings() # restore from settings context2 = QgsCoordinateTransformContext() self.assertEqual(context2.coordinateOperations(), {}) context2.readSettings() # check result self.assertEqual(context2.coordinateOperations(), {('EPSG:4204', 'EPSG:4326'): proj_1, ('EPSG:4205', 'EPSG:4326'): proj_2})
def testReadWriteSettings(self): context = QgsCoordinateTransformContext() context.readSettings() source_id_1 = QgsDatumTransform.datumTransformations( QgsCoordinateReferenceSystem('EPSG:4204'), QgsCoordinateReferenceSystem('EPSG:4326'))[0].sourceTransformId dest_id_1 = QgsDatumTransform.datumTransformations( QgsCoordinateReferenceSystem('EPSG:4204'), QgsCoordinateReferenceSystem( 'EPSG:4326'))[0].destinationTransformId source_id_2 = QgsDatumTransform.datumTransformations( QgsCoordinateReferenceSystem('EPSG:4205'), QgsCoordinateReferenceSystem('EPSG:4326'))[0].sourceTransformId dest_id_2 = QgsDatumTransform.datumTransformations( QgsCoordinateReferenceSystem('EPSG:4205'), QgsCoordinateReferenceSystem( 'EPSG:4326'))[0].destinationTransformId # should be empty self.assertEqual(context.sourceDestinationDatumTransforms(), {}) self.assertTrue( context.addSourceDestinationDatumTransform( QgsCoordinateReferenceSystem('EPSG:4204'), QgsCoordinateReferenceSystem('EPSG:4326'), source_id_1, dest_id_1)) self.assertTrue( context.addSourceDestinationDatumTransform( QgsCoordinateReferenceSystem('EPSG:4205'), QgsCoordinateReferenceSystem('EPSG:4326'), source_id_2, dest_id_2)) self.assertEqual( context.sourceDestinationDatumTransforms(), { ('EPSG:4204', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_1, dest_id_1), ('EPSG:4205', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_2, dest_id_2) }) # save to settings context.writeSettings() # restore from settings context2 = QgsCoordinateTransformContext() self.assertEqual(context2.sourceDestinationDatumTransforms(), {}) context2.readSettings() # check result self.assertEqual( context2.sourceDestinationDatumTransforms(), { ('EPSG:4204', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_1, dest_id_1), ('EPSG:4205', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_2, dest_id_2) })
def testReadWriteSettings(self): context = QgsCoordinateTransformContext() context.readSettings() source_id_1 = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4204), QgsCoordinateReferenceSystem(4326))[0].sourceTransformId dest_id_1 = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4204), QgsCoordinateReferenceSystem(4326))[0].destinationTransformId source_id_2 = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4205), QgsCoordinateReferenceSystem(4326))[0].sourceTransformId dest_id_2 = QgsDatumTransform.datumTransformations(QgsCoordinateReferenceSystem(4205), QgsCoordinateReferenceSystem(4326))[0].destinationTransformId # should be empty self.assertEqual(context.sourceDestinationDatumTransforms(), {}) self.assertTrue(context.addSourceDestinationDatumTransform(QgsCoordinateReferenceSystem('EPSG:4204'), QgsCoordinateReferenceSystem('EPSG:4326'), source_id_1, dest_id_1)) self.assertTrue(context.addSourceDestinationDatumTransform(QgsCoordinateReferenceSystem('EPSG:4205'), QgsCoordinateReferenceSystem(4326), source_id_2, dest_id_2)) self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:4204', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_1, dest_id_1), ('EPSG:4205', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_2, dest_id_2)}) # save to settings context.writeSettings() # restore from settings context2 = QgsCoordinateTransformContext() self.assertEqual(context2.sourceDestinationDatumTransforms(), {}) context2.readSettings() # check result self.assertEqual(context2.sourceDestinationDatumTransforms(), {('EPSG:4204', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_1, dest_id_1), ('EPSG:4205', 'EPSG:4326'): QgsDatumTransform.TransformPair(source_id_2, dest_id_2)})