Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #713 from minorua/ftools
fTools fixes
  • Loading branch information
NathanW2 committed Jul 14, 2013
2 parents 9b4f461 + 6088fd7 commit f6c057e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
33 changes: 6 additions & 27 deletions python/plugins/fTools/tools/doGeoprocessing.py
Expand Up @@ -903,11 +903,6 @@ def intersect( self ):
else:
crs_match = crsA == crsB
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if longNames:
message = self.tr('Following field names are longer than 10 characters:\n%s') % ( '\n'.join(longNames) )
return GEOS_EXCEPT, FEATURE_EXCEPT, crs_match, message

writer = QgsVectorFileWriter( self.myName, self.myEncoding, fields,
vproviderA.geometryType(), vproviderA.crs() )
if writer.hasError():
Expand Down Expand Up @@ -955,8 +950,7 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
Expand Down Expand Up @@ -987,8 +981,7 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except:
EATURE_EXCEPT = False
Expand Down Expand Up @@ -1027,8 +1020,7 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
Expand Down Expand Up @@ -1061,8 +1053,7 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
Expand All @@ -1088,11 +1079,6 @@ def union( self ):
crs_match = crsA == crsB

fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if longNames:
message = self.tr( 'Following field names are longer than 10 characters:\n%s' ) % ( "\n".join(longNames) )
return GEOS_EXCEPT, FEATURE_EXCEPT, crs_match, message

writer = QgsVectorFileWriter( self.myName, self.myEncoding, fields,
vproviderA.geometryType(), vproviderA.crs() )
if writer.hasError():
Expand Down Expand Up @@ -1163,8 +1149,7 @@ def union( self ):
int_geom = QgsGeometry( i )
try:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except Exception, err:
FEATURE_EXCEPT = False
Expand All @@ -1177,8 +1162,7 @@ def union( self ):
if int_geom.wkbType() in gList:
try:
outFeat.setGeometry( int_geom )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
outFeat.setAttributes( atMapA + atMapB )
writer.addFeature( outFeat )
except Exception, err:
FEATURE_EXCEPT = False
Expand Down Expand Up @@ -1274,11 +1258,6 @@ def symetrical_difference( self ):
crs_match = crsA == crsB

fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if longNames:
message = self.tr( 'Following field names are longer than 10 characters:\n%s' ) % ( "\n".join(longNames) )
return GEOS_EXCEPT, FEATURE_EXCEPT, crs_match, message

writer = QgsVectorFileWriter( self.myName, self.myEncoding, fields,
vproviderA.geometryType(), vproviderA.crs() )
if writer.hasError():
Expand Down
8 changes: 0 additions & 8 deletions python/plugins/fTools/tools/doSpatialJoin.py
Expand Up @@ -146,14 +146,6 @@ def compute(self, inName, joinName, outName, summary, sumList, keep, progressBar
seq = range(0, len(fieldList1))
fieldList1 = dict(zip(seq, fieldList1))

# check for correct field names
print fieldList1
longNames = ftools_utils.checkFieldNameLength( fieldList1.values() )
if len( longNames ) > 0:
QMessageBox.warning( self, self.tr( 'Incorrect field names' ),
self.tr( 'No output will be created.\nFollowing field names are longer than 10 characters:\n%s' ) % ( "\n".join(longNames) ) )
return False

sRs = provider1.crs()
progressBar.setValue(13)
check = QFile(self.shapefileName)
Expand Down

0 comments on commit f6c057e

Please sign in to comment.