I am trying to create a model using the QGIS 2.0 Processing Toolbox graphical model to replicate the process described in this thread: How to horizontally align irregularly shaped point symbol to vector layer in QGIS?
However, I get an error when trying to execute the Distance to Nearest Hub algorithm: Invalid name attribute: bearing. When I go through the process manually, using the same data, this doesn't happen.
UPDATE: running the field calculator using the python console doesn't populate my vector layer's bearing field as I expected it to. A field called "bearing" is created in a new output layer (i've corrected to link this to distance to nearest hub instead of how it is currently), but the field is blank.
I ran the script like so after import processing:
processing.runalg("qgis:fieldcalculator", resLayer, 'bearing', 0, '(atan((xat(-1)-xat(0))/(yat(-1)-yat(0)))) * 180/3.14159 + (180 *(((yat(-1)-yat(0)) < 0) + (((xat(-1)-xat(0)) < 0 AND (yat(-1) - yat(0)) >0)*2)))', 'bearingdata.shp')