I try to move points (they come as WGS84, but I'm not sure if it works with unprojected CRS) by a specified distance and connect original and new point with a line segment with the below script, but get an error (EDIT: is fixed now..):
#ERROR: 'module' object has no attribute 'getobject' --> fixed syntax error!
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.VectorWriter import VectorWriter
#====================================
##[User scripts]=group
##input=vector
##output=output vector
##x_add=number 100
##y_add=number 100
#====================================
inputLayer = processing.getObject(input) # formerly getobject()
features = processing.features(inputLayer) # formerly getFeatures()
provider = inputLayer.dataProvider()
writer = VectorWriter(output, None, provider.fields(), WKBLineString , inputLayer.crs())
for ft in features:
line_start = ft.geometry().asPoint()
line_end = QgsPoint(line_start.x()+x_add, line_start.y()+y_add)
outFeat = QgsFeature()
outFeat.setGeometry(QgsGeometry.fromPolyline([line_start, line_end]))
writer.addFeature(outFeat)
del writer
Furthermore I'd like to be able to move points by specifying the distance in map units (m), I'm not sure if this is what's actually happening here.