[Qgis-developer] pyqgis QgsGeometry.convertToMultiType() fails

Paolo Corti pcorti at gmail.com
Thu Nov 28 13:03:49 PST 2013


Hi devs

I have a strange behavior with the QgsGeometry.convertToMultiType()
method here: it looks like the method is always failing the first
time, but getting success the second time is run:

In [1]: from qgis.core import *

In [2]: wkt = 'POLYGON((2283519.55884151300415397
4679066.13715541176497936,2283544.75336170010268688
4679033.60118563380092382,2283525.45749358925968409
4679011.69776777736842632,2283506.92586500011384487
4679037.65943400003015995,2283487.47002476220950484
4679065.54728745669126511,2283519.55884151300415397
4679066.13715541176497936))'

In [3]: polygon = QgsGeometry.fromWkt(wkt)

In [4]: polygon.convertToMultiType()
Out[4]: False

In [5]: print polygon.exportToWkt()
POLYGON((2283519.55884151300415397
4679066.13715541176497936,2283544.75336170010268688
4679033.60118563380092382,2283525.45749358925968409
4679011.69776777736842632,2283506.92586500011384487
4679037.65943400003015995,2283487.47002476220950484
4679065.54728745669126511,2283519.55884151300415397
4679066.13715541176497936))

In [6]: polygon.convertToMultiType()
Out[6]: True

In [7]: print polygon.exportToWkt()
MULTIPOLYGON(((2283519.55884151300415397
4679066.13715541176497936,2283544.75336170010268688
4679033.60118563380092382,2283525.45749358925968409
4679011.69776777736842632,2283506.92586500011384487
4679037.65943400003015995,2283487.47002476220950484
4679065.54728745669126511,2283519.55884151300415397
4679066.13715541176497936)))

a possible bug? Should I file a ticket?
thanks
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the Qgis-developer mailing list