Skip to content

Instantly share code, notes, and snippets.

@giohappy
Created October 29, 2015 17:18
Show Gist options
  • Save giohappy/796a06f1dedfffe38dec to your computer and use it in GitHub Desktop.
Save giohappy/796a06f1dedfffe38dec to your computer and use it in GitHub Desktop.
QGIS script for Processing to export WKT geometry representation
##Geometry=group
##Export WKT to file=name
##Input_Layer=vector
##Output_File=output file
from qgis.core import *
from PyQt4.QtCore import *
import processing
v_in = processing.getObject(Input_Layer)
with open(Output_File,"w") as f_out:
for f in v_in.getFeatures():
out_str = "{0},{1}".format(f.id(),f.geometry().exportToWkt())
f_out.write(out_str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment