Skip to content
Permalink
Browse files
fix #3661
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 48900197bc4934d814b5c512e45753caed741568
Showing with 18 additions and 1 deletion.
  1. +18 −1 python/plugins/fTools/tools/doGeometry.py
@@ -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()
@@ -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 = []

0 comments on commit 4890019

Please sign in to comment.