def outProjFile(self): header = "Define layer CRS:" sentence1 = self.tr( "Please select the projection system that defines the current layer." ) sentence2 = self.tr( "Layer CRS information will be updated to the selected CRS.") projSelector = QgsGenericProjectionSelector(self) projSelector.setMessage("<h2>%s</h2>%s <br/> %s" % (header, sentence1, sentence2)) if projSelector.exec_(): self.crs = QgsCoordinateReferenceSystem( projSelector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId) print "AUTHID", projSelector.selectedAuthId() if len(projSelector.selectedAuthId()) == 0: QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No Valid CRS selected")) return else: self.txtProjection.clear() self.txtProjection.insert(self.crs.authid() + " - " + self.crs.description()) else: return
def on_cmdOutCRS_clicked(self): dlg = QgsGenericProjectionSelector(self) dlg.setMessage(self.tr('Select coordinate system')) if dlg.exec_(): if dlg.selectedAuthId() != '': self.outQgsCRS = QgsCoordinateReferenceSystem( dlg.selectedAuthId()) if self.outQgsCRS.geographicFlag(): self.outQgsCRS = None self.send_to_messagebar(unicode( self. tr("Geographic coordinate systems are not allowed. Resetting to default.." )), level=QgsMessageBar.WARNING, duration=5) else: self.outQgsCRS = None if self.outQgsCRS is None: self.autoSetCoordinateSystem() self.lblOutCRSTitle.setStyleSheet('color:black') self.lblOutCRS.setStyleSheet('color:black') self.lblOutCRS.setText( self.tr('{} - {}'.format(self.outQgsCRS.description(), self.outQgsCRS.authid())))
def onSpecifyCRS(self): selector = QgsGenericProjectionSelector(self) selector.setMessage("Specify CRS of the mesh file") selector.setSelectedCrsId(self.layer.crs().srsid()) if selector.exec_(): self.crs = QgsCoordinateReferenceSystem(selector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId) self.updateEditCRS()
def onSpecifyCRS(self): selector = QgsGenericProjectionSelector(self) selector.setMessage("Specify CRS of the mesh file") selector.setSelectedCrsId(self.layer.crs().srsid()) if selector.exec_(): self.crs = QgsCoordinateReferenceSystem( selector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId) self.updateEditCRS()
def setSrc(self): projSelector = QgsGenericProjectionSelector() projSelector.setMessage(theMessage='Por favor, selecione um sistema de coordenada !') projSelector.exec_() if projSelector.selectedAuthId(): epsg = int(projSelector.selectedAuthId().split(':')[-1]) # test = QgsCoordinateReferenceSystem(epsg, QgsCoordinateReferenceSystem.EpsgCrsId) self.SRCLineEdit.setText(str(epsg)) self.epsg = epsg else: self.msg(u"Selecione SRC para criar Banco !")
def on_srsButton_clicked(self): projSelector = QgsGenericProjectionSelector() message = self.tr('Select the Spatial Reference System!') projSelector.setMessage(theMessage=message) if not projSelector.exec_(): QMessageBox.warning(self, self.tr("Warning!"), message) return else: self.epsg = int(projSelector.selectedAuthId().split(':')[-1]) srs = QgsCoordinateReferenceSystem( self.epsg, QgsCoordinateReferenceSystem.EpsgCrsId) self.srLineEdit.setText(srs.description())
def on_crsButton_clicked(self): projSelector = QgsGenericProjectionSelector() message = 'Select the Spatial Reference System!' projSelector.setMessage(theMessage=message) projSelector.exec_() try: epsg = int(projSelector.selectedAuthId().split(':')[-1]) self.crs = QgsCoordinateReferenceSystem(epsg, QgsCoordinateReferenceSystem.EpsgCrsId) if self.crs: self.crsLineEdit.setText(self.crs.description()) except: QMessageBox.warning(self, self.tr("Warning!"), self.tr(message))
def on_crsButton_clicked(self): projSelector = QgsGenericProjectionSelector() message = 'Select the Spatial Reference System!' projSelector.setMessage(theMessage=message) projSelector.exec_() try: epsg = int(projSelector.selectedAuthId().split(':')[-1]) self.crs = QgsCoordinateReferenceSystem( epsg, QgsCoordinateReferenceSystem.EpsgCrsId) if self.crs: self.crsLineEdit.setText(self.crs.description()) except: QMessageBox.warning(self, self.tr("Warning!"), self.tr(message))
def setaSistCoordCriaSpatialite(self): projSelector = QgsGenericProjectionSelector() projSelector.setMessage(theMessage=self.tr('Please, select the coordinate system')) projSelector.exec_() try: self.epsgCriaSpatialite = int(projSelector.selectedAuthId().split(':')[-1]) self.srsCriaSpatialite = QgsCoordinateReferenceSystem(self.epsgCriaSpatialite, QgsCoordinateReferenceSystem.EpsgCrsId) if self.srsCriaSpatialite <> "": self.coordSysDefinido = True self.coordSysCriaSpatialiteLineEdit.setText(self.srsCriaSpatialite.description()) except: self.bar.pushMessage("", self.tr('Please, select the coordinate system'), level=QgsMessageBar.WARNING) pass
def on_srsButton_clicked(self): ''' Opens the dialog to select CRS ''' projSelector = QgsGenericProjectionSelector() message = self.tr('Select the Spatial Reference System!') projSelector.setMessage(theMessage=message) if not projSelector.exec_(): QMessageBox.warning(self, self.tr("Warning!"), message) return else: self.epsg = int(projSelector.selectedAuthId().split(':')[-1]) srs = QgsCoordinateReferenceSystem(self.epsg, QgsCoordinateReferenceSystem.EpsgCrsId) self.srLineEdit.setText(srs.description())
def on_pbnCrs_pressed(self): selector = QgsGenericProjectionSelector(self) selector.setMessage(); if self.layerCrs.description(): selector.setSelectedCrsId( self.layerCrs.srsid() ); elif self.selectedCrs.description(): selector.setSelectedCrsId( self.selectedCrs.srsid() ); if selector.exec_(): self.selectedCrs.createFromId( selector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId ); self.ui.cboCrs.setCurrentIndex(2) if self.selectedCrs.description(): self.ui.cboCrs.setItemText(2, self.tr( "Selected" ) + " (%s, %s)" % (self.selectedCrs.description(), self.selectedCrs.authid()) ) else: self.ui.cboCrs.setItemText(2, self.tr("Selected (None)"))
def on_srsButton_clicked(self): """ Opens the CRS selector dialog """ projSelector = QgsGenericProjectionSelector() message = 'Select the Spatial Reference System!' projSelector.setMessage(theMessage=message) projSelector.exec_() try: self.epsg = int(projSelector.selectedAuthId().split(':')[-1]) srs = QgsCoordinateReferenceSystem(self.epsg, QgsCoordinateReferenceSystem.EpsgCrsId) if srs: self.srsEdit.setText(srs.description()) else: self.epsg = 4326 except: QMessageBox.warning(self, self.tr("Warning!"), message)
def outProjFile(self): header = "Define layer CRS:" sentence1 = self.tr("Please select the projection system that defines the current layer.") sentence2 = self.tr("Layer CRS information will be updated to the selected CRS.") projSelector = QgsGenericProjectionSelector(self) projSelector.setMessage("<h2>%s</h2>%s <br/> %s" % (header, sentence1, sentence2)) if projSelector.exec_(): self.crs = QgsCoordinateReferenceSystem(projSelector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId) print "AUTHID", projSelector.selectedAuthId() if len(projSelector.selectedAuthId()) == 0: QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No Valid CRS selected")) return else: self.txtProjection.clear() self.txtProjection.insert(self.crs.authid() + " - " + self.crs.description()) else: return
def on_srsButton_clicked(self): """ Opens the CRS selector dialog """ projSelector = QgsGenericProjectionSelector() message = 'Select the Spatial Reference System!' projSelector.setMessage(theMessage=message) projSelector.exec_() try: self.epsg = int(projSelector.selectedAuthId().split(':')[-1]) srs = QgsCoordinateReferenceSystem( self.epsg, QgsCoordinateReferenceSystem.EpsgCrsId) if srs: self.srsEdit.setText(srs.description()) else: self.epsg = 4326 except: QMessageBox.warning(self, self.tr("Warning!"), message)
def on_cmdInCRS_clicked(self): dlg = QgsGenericProjectionSelector(self) dlg.setMessage('Select coordinate system for the input file geometry') if self.vesper_qgscrs is not None: dlg.setSelectedAuthId(self.vesper_qgscrs.authid()) if dlg.exec_(): if dlg.selectedAuthId() != '': # ie clicked ok without selecting a projection crs = QgsCoordinateReferenceSystem(dlg.selectedAuthId()) if crs == 'Unspecified' or crs == '': self.vesper_qgscrs = None self.lneInCRS.setText('Unspecified') else: self.vesper_qgscrs = QgsCoordinateReferenceSystem(crs) self.vesper_qgscrs.validate() self.lneInCRS.setText( '{} - {}'.format(self.vesper_qgscrs.description(), self.vesper_qgscrs.authid())) self.lneInCRS.setStyleSheet('color:black;background:transparent;') self.lblInCRSTitle.setStyleSheet('color:black')
def on_cmdInCRS_clicked(self): self.messageBar.clearWidgets() dlg = QgsGenericProjectionSelector(self) dlg.setMessage('Select coordinate system for the Vesper raster files') if dlg.exec_(): if dlg.selectedAuthId() != '': self.in_qgscrs = QgsCoordinateReferenceSystem(dlg.selectedAuthId()) if self.in_qgscrs == 'Unspecified' or self.in_qgscrs == '': self.lblInCRS.setText('Unspecified') self.lblOutCRS.setText('Unspecified') else: self.lblInCRS.setText('{} - {}'.format(self.in_qgscrs.description(), self.in_qgscrs.authid())) self.lblInCRS.setStyleSheet('color:black;background:transparent;') self.lblInCRSTitle.setStyleSheet('color:black') self.cleanMessageBars(self)
def on_pbnCrs_pressed(self): selector = QgsGenericProjectionSelector(self) selector.setMessage() if self.layerCrs.description(): selector.setSelectedCrsId(self.layerCrs.srsid()) elif self.selectedCrs.description(): selector.setSelectedCrsId(self.selectedCrs.srsid()) if selector.exec_(): self.selectedCrs.createFromId( selector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId) self.ui.cboCrs.setCurrentIndex(2) if self.selectedCrs.description(): self.ui.cboCrs.setItemText( 2, self.tr("Selected") + " (%s, %s)" % (self.selectedCrs.description(), self.selectedCrs.authid())) else: self.ui.cboCrs.setItemText(2, self.tr("Selected (None)"))
def geomapfishCrsButtonClicked(self): dlg = QgsGenericProjectionSelector(self) dlg.setMessage('Select GeoMapFish CRS') dlg.setSelectedAuthId(self.geomapfishCrs.text()) if dlg.exec_(): self.geomapfishCrs.setText(dlg.selectedAuthId())