[Qgis-developer] Pb transforming points in mulitpolyline

Vincent Damoy vincent.damoy at espaces-naturels.fr
Fri Mar 14 02:55:20 PDT 2014


Hello all,
I've got a strange problem with a python function in my QGIS 2.2.0 plugin:

This first function works perfectly:

/def points_linestring (pointgeoms)://
//    return QgsGeometry.fromPolyline([point.asPoint() for point in 
pointgeoms])/

pointgeoms contains points.
The function transforms these in a linestring.

BUT, if I want a multipolyline, and if I try :

/def points_linestring (pointgeoms)://
//    return QgsGeometry.fromMultiPolyline([point.asPoint() for point in 
pointgeoms])/

(I've juste added "Multi"),
Qgis returns :

"/home/vincent/.qgis2/python/plugins/bdtravaux/convert_geoms.py", line 
70, in points_linestring
     return QgsGeometry.fromMultiPolyline(polyligne.asPolyline())
TypeError: QgsGeometry.fromMultiPolyline(unknown-type): argument 1 has 
unexpected type 'list'

Does somebody know why this function works with fromPolyline() and not 
fromMultiPolyline()?
I found nothing about this in the doc and in google searchs.

Thanks for advance.
Vincent

---------------------------

Vincent Damoy - Responsable SIG
Conservatoire d'espaces naturels du Nord et du Pas-de-Calais
152 bd de Paris - 62190 Lillers
Tél : 03.21.54.75.00 - Fax : 03.21.54.56.07
/*Pour adhérer au Conservatoire :* 
www.cen-npdc.org/nous-rejoindre/adherent.html/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140314/21eb61b0/attachment.html>


More information about the Qgis-developer mailing list