[Qgis-user] Clipping a QgsVectorLayer object of type LineString with a QgsVectorLayer object of type Polygon

Tudorache, Marian Marian.Tudorache at navcanada.ca
Fri May 19 07:02:14 PDT 2017


Hi,

I have tried to run clipping processing algorithm and it fails.
First version:
srs = qgis.core.QgsCoordinateReferenceSystem(4019, qgis.core. QgsCoordinateReferenceSystem.EpsgCrsId)

#Input Layer
inputLayer = qgis.core.QgsVectorLayer(shapeFileLocation + “/inputLineString.shp”, “inputLineString”, “ogr”)
inputLayer.setCrs(srs)
Clipping Layer:
clipLayer = qgis.core.QgsVectorLayer(“Polygon?crs={0}”.format(srs.authid())
#algorithm to add a clipping polygon feature
#the algorithm works because I tested with clipLayer.getFeatures() and I was able to extract the geometry and points
…..
….
#calling processing algorithm.
processing.runalg(‘qgis.clip’, inputLayer, clipLayer, “output.shp”)

The error:
Unable to execute algorithm
Wrong parameter value: Polygon?crs=ESPG:4019

Any idea why is not working?

Thank you,
Marian

________________________________

This electronic message, as well as any transmitted files included in the electronic message, may contain privileged or confidential information and is intended solely for the use of the individual(s) or entity to which it is addressed. If you have received this electronic message in error please notify the sender immediately and delete the electronic message. Any unauthorized copying, disclosure or distribution of the electronic message is strictly forbidden. NAV CANADA accepts no liability for any damage caused by any virus and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent contenir des renseignements privilégiés ou confidentiels destinés à l’usage exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez reçu ce message électronique par erreur, veuillez en informer l’expéditeur immédiatement et supprimez le. Toute reproduction, divulgation ou distribution du présent message électronique est strictement interdite. NAV CANADA n’assume aucune responsabilité en cas de dommage causé par tout virus ou autre programme malveillant transmis par ce message électronique.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170519/c4d70f01/attachment.html>


More information about the Qgis-user mailing list