@@ -970,9 +970,15 @@ def intersect( self ):
970
970
int_sym = geom .symDifference ( tmpGeom )
971
971
int_geom = QgsGeometry ( int_com .difference ( int_sym ) )
972
972
try :
973
- outFeat .setGeometry ( int_geom )
974
- outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
975
- writer .addFeature ( outFeat )
973
+ # Geometry list: prevents writing error
974
+ # in geometries of different types
975
+ # produced by the intersection
976
+ # fix #3549
977
+ gList = ftools_utils .getGeomType ( geom .wkbType () )
978
+ if int_geom .wkbType () in gList :
979
+ outFeat .setGeometry ( int_geom )
980
+ outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
981
+ writer .addFeature ( outFeat )
976
982
except :
977
983
FEATURE_EXCEPT = False
978
984
continue
@@ -999,9 +1005,11 @@ def intersect( self ):
999
1005
int_sym = geom .symDifference ( tmpGeom )
1000
1006
int_geom = QgsGeometry ( int_com .difference ( int_sym ) )
1001
1007
try :
1002
- outFeat .setGeometry ( int_geom )
1003
- outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1004
- writer .addFeature ( outFeat )
1008
+ gList = ftools_utils .getGeomType ( geom .wkbType () )
1009
+ if int_geom .wkbType () in gList :
1010
+ outFeat .setGeometry ( int_geom )
1011
+ outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1012
+ writer .addFeature ( outFeat )
1005
1013
except :
1006
1014
EATURE_EXCEPT = False
1007
1015
continue
@@ -1037,9 +1045,11 @@ def intersect( self ):
1037
1045
int_sym = geom .symDifference ( tmpGeom )
1038
1046
int_geom = QgsGeometry ( int_com .difference ( int_sym ) )
1039
1047
try :
1040
- outFeat .setGeometry ( int_geom )
1041
- outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1042
- writer .addFeature ( outFeat )
1048
+ gList = ftools_utils .getGeomType ( geom .wkbType () )
1049
+ if int_geom .wkbType () in gList :
1050
+ outFeat .setGeometry ( int_geom )
1051
+ outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1052
+ writer .addFeature ( outFeat )
1043
1053
except :
1044
1054
FEATURE_EXCEPT = False
1045
1055
continue
@@ -1066,9 +1076,11 @@ def intersect( self ):
1066
1076
int_sym = geom .symDifference ( tmpGeom )
1067
1077
int_geom = QgsGeometry ( int_com .difference ( int_sym ) )
1068
1078
try :
1069
- outFeat .setGeometry ( int_geom )
1070
- outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1071
- writer .addFeature ( outFeat )
1079
+ gList = ftools_utils .getGeomType ( geom .wkbType () )
1080
+ if int_geom .wkbType () in gList :
1081
+ outFeat .setGeometry ( int_geom )
1082
+ outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1083
+ writer .addFeature ( outFeat )
1072
1084
except :
1073
1085
FEATURE_EXCEPT = False
1074
1086
continue
@@ -1180,12 +1192,18 @@ def union( self ):
1180
1192
except Exception , err :
1181
1193
FEATURE_EXCEPT = False
1182
1194
else :
1183
- try :
1184
- outFeat .setGeometry ( int_geom )
1185
- outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1186
- writer .addFeature ( outFeat )
1187
- except Exception , err :
1188
- FEATURE_EXCEPT = False
1195
+ # Geometry list: prevents writing error
1196
+ # in geometries of different types
1197
+ # produced by the intersection
1198
+ # fix #3549
1199
+ gList = ftools_utils .getGeomType ( geom .wkbType () )
1200
+ if int_geom .wkbType () in gList :
1201
+ try :
1202
+ outFeat .setGeometry ( int_geom )
1203
+ outFeat .setAttributeMap ( ftools_utils .combineVectorAttributes ( atMapA , atMapB ) )
1204
+ writer .addFeature ( outFeat )
1205
+ except Exception , err :
1206
+ FEATURE_EXCEPT = False
1189
1207
else :
1190
1208
# this only happends if the bounding box
1191
1209
# intersects, but the geometry doesn't
0 commit comments