def set_dst_crs(self):
     try:
         frmCRS = QgsProjectionSelectionDialog(self._main_form)
         if frmCRS.exec_():
             if frmCRS.crs() is not None and frmCRS.crs().authid():
                 self.destination_crs_name = frmCRS.crs().authid()
                 self._main_form.map_widget.update_project_map_crs_info(self.destination_crs_name)
                 self._main_form.txtCrs.setText(self.destination_crs_name)
     except:
         pass
 def crsTriggered(self, action):
     self.crsButton.setDefaultAction(action)
     self.inputProjection = action.data()
     if self.inputProjection == 3:
         selector = QgsProjectionSelectionDialog()
         selector.setCrs(QgsCoordinateReferenceSystem(self.inputCustomCRS))
         if selector.exec():
             self.inputCustomCRS = selector.crs().authid()
         else:
             self.inputCustomCRS = 'EPSG:4326'
     self.saveSettings()
    def selectOtherCrs(self, checked):
        self.l_OtherCrsName.setEnabled(checked)
        self.pb_OtherCrs.setEnabled(checked)

        if checked:
            if self.otherCrsId is None:
                crsSelector = QgsProjectionSelectionDialog()
                crsSelector.setCrs(QgsCoordinateReferenceSystem("EPSG:4326"))
                if crsSelector.exec():
                    self.otherCrsId = crsSelector.crs().srsid()
                    self.featureCrsId = self.otherCrsId
                self.__displayAuthid()
    def testDialogNotSetOption(self):
        """ test allowing no projection option for QgsProjectionSelectionTreeWidget """
        w = QgsProjectionSelectionDialog()
        w.show()
        w.setShowNoProjection(True)
        self.assertTrue(w.showNoProjection())
        w.setShowNoProjection(False)
        self.assertFalse(w.showNoProjection())

        w.setShowNoProjection(True)
        w.setCrs(QgsCoordinateReferenceSystem())
        self.assertFalse(w.crs().isValid())
 def testDialogGettersSetters(self):
     """ basic tests for QgsProjectionSelectionTreeWidget """
     w = QgsProjectionSelectionDialog()
     w.show()
     w.setCrs(QgsCoordinateReferenceSystem('EPSG:3111'))
     self.assertEqual(w.crs().authid(), 'EPSG:3111')
Beispiel #6
0
 def changeCRS(self):
     projSelector = QgsProjectionSelectionDialog()
     projSelector.exec_()
     self.crs = projSelector.crs()
     self.crsLabel.setText(self.crs.authid())
Beispiel #7
0
 def changeCRS(self):
     projSelector = QgsProjectionSelectionDialog()
     projSelector.exec_()
     self.crs = projSelector.crs()
     self.crsLabel.setText(self.crs.authid())
Beispiel #8
0
from qgis.gui import QgsProjectionSelectionDialog

lyr = iface.activeLayer()
crs_select = QgsProjectionSelectionDialog()
crs_select.exec_()
selectedcrsdef = crs_select.crs()
selectedcrs = selectedcrsdef.authid()
epsg_code = selectedcrs.split(":")
code = epsg_code[1]
for f in lyr.getFeatures():
    if code != f["SR_EPSG"]:
        print('diverso')
    else:
        print('uguale')