Skip to content

Commit

Permalink
correctly handle user defined CRSes (fix #5257)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 16, 2012
1 parent a4017a2 commit 51ff2b5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/plugins/fTools/tools/doDefineProj.py
Expand Up @@ -59,6 +59,8 @@ def __init__(self, iface):
self.inShape.addItems(layers)
self.cmbLayer.addItems(layers)

self.crs = None

def updateProj1(self, layerName):
self.inRef.clear()
tempLayer = ftools_utils.getVectorLayerByName(layerName)
Expand Down Expand Up @@ -94,11 +96,10 @@ def accept(self):
if vLayer == "Error":
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Cannot define projection for PostGIS data...yet!"))
else:
srsDefine = QgsCoordinateReferenceSystem()
srsDefine = None
if self.rdoProjection.isChecked():
outProj = self.txtProjection.text().split( " - " )[ 0 ]
#srsDefine.createFromProj4(outProj)
srsDefine.createFromString(outProj)
srsDefine = self.crs
else:
destLayer = ftools_utils.getVectorLayerByName(self.cmbLayer.currentText())
srsDefine = destLayer.crs()
Expand Down Expand Up @@ -151,13 +152,12 @@ def outProjFile(self):
projSelector = QgsGenericProjectionSelector(self)
projSelector.setMessage( format.arg( header ).arg( sentence1 ).arg( sentence2 ))
if projSelector.exec_():
crs = QgsCoordinateReferenceSystem()
crs.createFromOgcWmsCrs( projSelector.selectedAuthId() )
self.crs = QgsCoordinateReferenceSystem( projSelector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId )
if projSelector.selectedAuthId().isEmpty():
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No Valid CRS selected"))
return
else:
self.txtProjection.clear()
self.txtProjection.insert(crs.authid() + " - " + crs.description())
self.txtProjection.insert(self.crs.authid() + " - " + self.crs.description())
else:
return

0 comments on commit 51ff2b5

Please sign in to comment.