Skip to content
Permalink
Browse files

More specific warnings for geoprocessing tools when missing crs are d…

…etected. Addresses #2547.

git-svn-id: http://svn.osgeo.org/qgis/trunk@13503 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
cfarmer
cfarmer committed May 16, 2010
1 parent 6ad80f9 commit 31817beb090809248c62eafea9a8feb9e62bebd9
Showing with 41 additions and 12 deletions.
  1. +41 −12 python/plugins/fTools/tools/doGeoprocessing.py
@@ -207,14 +207,17 @@ def runFinishedFromThread( self, results ):
self.tr( "No output created. File creation error:\n%1" )
.arg( results[3] ) )
return
if not results[2] or not results[1] or not results [0]:
if (not results[2] is None and not results[2]) or not results[1] or not results [0]:
out_text = self.tr( "\nWarnings:" )
end_text = self.tr( "\nSome output geometries may be missing or invalid.\n\nWould you like to add the new layer anyway?" )
else:
out_text = "\n"
end_text = self.tr( "\n\nWould you like to add the new layer to the TOC?" )
if not results[2]:
out_text = out_text + self.tr( "\nInput CRS error: Different input coordinate reference systems detected, results may not be as expected.")
if not results[2] is None:
if not results[2]:
out_text = out_text + self.tr( "\nInput CRS error: Different input coordinate reference systems detected, results may not be as expected.")
else:
out_text = out_text + self.tr( "\nInput CRS error: One or more input layers missing coordinate reference information, results may not be as expected.")
if not results[1]:
out_text = out_text + self.tr( "\nFeature geometry error: One or more output features ignored due to invalid geometry.")
if not results[0]:
@@ -693,8 +696,13 @@ def difference( self ):
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
fields = vproviderA.fields()
if vproviderA.crs() == vproviderB.crs(): crs_match = True
else: crs_match = False
# check for crs compatability
crsA = vproviderA.crs()
crsB = vproviderB.crs()
if not crsA.isValid() or not crsB.isValid():
crs_match = None
else:
crs_match = crsA == crsB
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vproviderA.geometryType(), vproviderA.crs() )
inFeatA = QgsFeature()
@@ -844,7 +852,13 @@ def intersect( self ):
vproviderB = self.vlayerB.dataProvider()
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
crs_match = vproviderA.crs() == vproviderB.crs()
# check for crs compatability
crsA = vproviderA.crs()
crsB = vproviderB.crs()
if not crsA.isValid() or not crsB.isValid():
crs_match = None
else:
crs_match = crsA == crsB
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if not longNames.isEmpty():
@@ -1006,8 +1020,13 @@ def union( self ):
vproviderB = self.vlayerB.dataProvider()
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
if vproviderA.crs() == vproviderB.crs(): crs_match = True
else: crs_match = False
# check for crs compatability
crsA = vproviderA.crs()
crsB = vproviderB.crs()
if not crsA.isValid() or not crsB.isValid():
crs_match = None
else:
crs_match = crsA == crsB
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if not longNames.isEmpty():
@@ -1135,8 +1154,13 @@ def symetrical_difference( self ):
vproviderB = self.vlayerB.dataProvider()
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
if vproviderA.crs() == vproviderB.crs(): crs_match = True
else: crs_match = False
# check for crs compatability
crsA = vproviderA.crs()
crsB = vproviderB.crs()
if not crsA.isValid() or not crsB.isValid():
crs_match = None
else:
crs_match = crsA == crsB
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if not longNames.isEmpty():
@@ -1223,8 +1247,13 @@ def clip( self ):
vproviderB = self.vlayerB.dataProvider()
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
if vproviderA.crs() == vproviderB.crs(): crs_match = True
else: crs_match = False
# check for crs compatability
crsA = vproviderA.crs()
crsB = vproviderB.crs()
if not crsA.isValid() or not crsB.isValid():
crs_match = None
else:
crs_match = crsA == crsB
fields = vproviderA.fields()
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vproviderA.geometryType(), vproviderA.crs() )

0 comments on commit 31817be

Please sign in to comment.
You can’t perform that action at this time.