Update: Adding example of line layer and point layers per @ConfusedButterfly request.

Below is a close up zoom of the line layer. Example of Line Layer

Below is the zoom out of the point layers (65 points). enter image description here

===================Post Update 21 Oct 22===========

I have simplified the model down to just the trouble step to make it easier to review (at suggestion of @ConfusedButterfly). It seems right now the trouble is that I cannot get the Translate function to read input from my point layers (more than 1 points). Unfortunately, still does not work.

Screenshot#1 - Simplified model

I tried 2 ways to reference in point layer input (Translate function seem to only take single number input as the Model Input). The expression i used and the error message log are per below. Screnshot# 2 below show one of the expression and screenshot#3 show the log's output

  • Try#1: Expression: to_real(x(geometry(get_feature_by_id(@wtglayout,'"Inst_Check"')))) Log Message: No reported error. But the delta X on log was report as "None" and the Line Layer was not translated.
  • Try#2: Expression: dbvaluebyid(@wtglayout,'X','Inst_Check'). Error Log: "Could not evaluate expression for parameter DELTA_X for Translate: Error: invalid targetLayerName"


Screenshot#3 ======================Original Post==========================

I'm trying to build a process model to automate my future works. I have got most of it to work until the very last step. In the last step, I need to translate a set of duplicated lines (an algorithm output from previous steps) to new location. The x & y off-set value for this algorithm output needs to be read from a point layer (a model input). You can see these highlighted steps/inputs/outputs on the screenshot below.

In the translate step window, I have tried to reference to the model input layer in several ways(called "Point Coordinates"/in the expression dialog, this is referenced as @wtglayout) but have not been successful so far. I keep getting error messages. Example of the expression I used and the corresponding error codes are below (one example screenshot to help visualize below too).

  • Code: x(@wtglayout) Error: Could not evaluate expression for parameter DELTA_X for Translate: Cannot convert to geometry
  • Code: x(geometry(@wtglayout)) Error: Could not evaluate expression for parameter DELTA_X for Translate: Cannot convert to feature
  • Code: x(geometry(get_feature_by_id(@wtglayout,'ID'))) Error: No error here. But the vector layer that was supposed to translate did not translate at all which suggests that the expression returned zero or NULL value.

I know I can do this translation step with no issue outside of Process Modeler but would really like to be able to automate this.

Screenshot 1 Process Model

Screenshot 2 Translate Step Input

[![Screehshot 3 Expression Dialogue][8]][8]

  • You have Join attributes by field value and Point Coordinates as input to Translate. Try to load those two layers and create a simpler model using those layers as input. If you can do the process outside of the modeler, try to debug by outputting the offset distance expression you put in offset distance using native:raisewarning. If all seems to be correct, maybe it's a dependence problem. It's a good practice to only explicitly set dependence in the modeler only to the algorithm that has no direct input-output connection to avoid facing race conditions. Oct 14, 2022 at 18:59
  • Thanks @ConfusedButterfly, i have set up a simplified model using the direct inputs. But still no luck. I have updated original post with this simplified model and additional screenshot.
    – Nghia Ha
    Oct 21, 2022 at 10:13
  • Please revise your question to focus it on where you are currently stuck.
    – PolyGeo
    Oct 21, 2022 at 20:53
  • @NghiaHa can you share an example layers for Line layer and the Point layer Oct 22, 2022 at 13:30
  • @PolyGeo, i have updated the question with the specific steps where i have the issue above. This has been made clear from the original post.
    – Nghia Ha
    Oct 24, 2022 at 10:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.