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

Giuseppe Sucameli brush.tyler at gmail.com
Thu Nov 28 13:23:12 PST 2013


Hi Paolo,

On Thu, Nov 28, 2013 at 10:03 PM, Paolo Corti <pcorti at gmail.com> wrote:

> 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:
>

I already got a similar behaviour and I tried to fix it anywhere in
QgsGeometry class one year ago (see d8ca9193b1)... but maybe I miss
some cases or something was changed from that date.

GeosGeometry and WKBGeometry are not synced, that's it.

Try to call polygon.convertToMultiType() multiple times without
exportToWkt().
I'm quite sure you will get false all the times.

File a ticket, please.
Cheers.


> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131128/d44cb29d/attachment.html>


More information about the Qgis-developer mailing list