[QGIS Commit] r15610 - trunk/qgis/python/plugins/fTools/tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Mar 26 18:29:20 EDT 2011
Author: jef
Date: 2011-03-26 15:29:20 -0700 (Sat, 26 Mar 2011)
New Revision: 15610
Modified:
trunk/qgis/python/plugins/fTools/tools/doGeometry.py
Log:
fix #3661
Modified: trunk/qgis/python/plugins/fTools/tools/doGeometry.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doGeometry.py 2011-03-26 15:55:18 UTC (rev 15609)
+++ trunk/qgis/python/plugins/fTools/tools/doGeometry.py 2011-03-26 22:29:20 UTC (rev 15610)
@@ -354,8 +354,9 @@
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 @@
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 = []
More information about the QGIS-commit
mailing list