Skip to content

Commit

Permalink
fix #3661
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15610 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 26, 2011
1 parent 8bf2268 commit 4890019
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion python/plugins/fTools/tools/doGeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ def multi_to_single( self ):
allAttrs = vprovider.attributeIndexes()
vprovider.select( allAttrs )
fields = vprovider.fields()
geomType = self.multiToSingleGeom(vprovider.geometryType())
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vprovider.geometryType()-3, vprovider.crs() )
fields, geomType, vprovider.crs() )
inFeat = QgsFeature()
outFeat = QgsFeature()
inGeom = QgsGeometry()
Expand Down Expand Up @@ -901,6 +902,22 @@ def singleToMultiGeom(self, wkbType):
except Exception, err:
print str(err)

def multiToSingleGeom(self, wkbType):
try:
if wkbType in (QGis.WKBPoint, QGis.WKBMultiPoint,
QGis.WKBPoint25D, QGis.WKBMultiPoint25D):
return QGis.WKBPoint
elif wkbType in (QGis.WKBLineString, QGis.WKBMultiLineString,
QGis.WKBMultiLineString25D, QGis.WKBLineString25D):
return QGis.WKBLineString
elif wkbType in (QGis.WKBPolygon, QGis.WKBMultiPolygon,
QGis.WKBMultiPolygon25D, QGis.WKBPolygon25D):
return QGis.WKBPolygon
else:
return QGis.WKBUnknown
except Exception, err:
print str(err)

def extractAsSingle( self, geom ):
multi_geom = QgsGeometry()
temp_geom = []
Expand Down

0 comments on commit 4890019

Please sign in to comment.