1

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?

enter image description here

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')
  • I am not really answering to your question, but on a related note, how do you make it such that you can see each element in your Processing Modeller? For mine, all my elements e.g. the algorithms included have text descriptions which happen to be truncated ("Vectorisation of..."), while yours does not depict any signs of truncation. Do you have any idea how I can achieve that? I am currently using QGIS Desktop 2.18.15 ![QGIS Processing Modeller](i.stack.imgur.com/QoyRN.jpg) – Johanness Jan 22 '18 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.