Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fTools fixes #713

Merged
merged 2 commits into from
Jul 14, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 6 additions & 27 deletions python/plugins/fTools/tools/doGeoprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this check has been removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok never mind read http://hub.qgis.org/issues/8241

vproviderA.geometryType(), vproviderA.crs() )
if writer.hasError():
Expand Down Expand Up @@ -943,8 +938,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 @@ -975,8 +969,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 @@ -1015,8 +1008,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 @@ -1049,8 +1041,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 @@ -1076,11 +1067,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 @@ -1151,8 +1137,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 @@ -1165,8 +1150,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 @@ -1262,11 +1246,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
Original file line number Diff line number Diff line change
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