Quantcast
Channel: Forum SIG - Systèmes d'Information Géographique et Géomatique
Viewing all articles
Browse latest Browse all 8030

[QGIS 2.x] Probleme d'application $length

$
0
0
Bonjour,

j'ai un problème, je n'arrive pas à appliquer la fonction $length dans mon script python (il est exécuté directement dans la console python).

processing.runalg("qgis:fieldcalculator","C:/test/DIF.shp", "L", 1, 10, 3, True,= $length,"C:/test/DIF2.shp")
File "<input>", line 1
processing.runalg("qgis:fieldcalculator","C:/test/DIF.shp", "L", 1, 10, 3, True,= $length,"C:/test/DIF2.shp")
^
SyntaxError: invalid syntax

je sais que si je rajoute des "" à $length sa marchera mais sans appliquer la fonction !

processing.runalg("qgis:fieldcalculator","C:/test/DIF.shp", "L", 1, 10, 3, True,"= $length","C:/test/DIF2.shp")
{'OUTPUT_LAYER': 'C:/test/DIF2.shp'}

comment faire ?

mon objectif est de pouvoir ajouter un champ "Longueur" sur prés de 420 shapes l'idée serait de ne pas avoir à les traiter 1 par 1 !

Viewing all articles
Browse latest Browse all 8030

Trending Articles