1

I have this model attached here wich has the left side (osm1) where the points input are beeing buffered - bounding box and the osm_highway is beeing downloaded. Model: Conditional Branch

The left side (osm2) should be an alternative option if the osm_highway is already known. OSM2 input is not mandatory.The conditional branch is checking if the boolean checkbox "check" is activated: Conditional Branch

The Conditional Branch is working - osm1 / osm2 are beeing generated. So far so good. The problem that I have is at the level of the function "Snap ponts on lines" where I an trying to define the line input as the following expression :

if(@check ,@reproject_osm2_OUTPUT  ,@osm1_OUTPUT ) 

Snap Points on Lines

where the dependencies of the function "Snap ponts on lines" where choosen like follow:

Snap points on lines - dependencies

The result of "Snap ponts on lines" is working just for osm1 , osm2 is not functioning. Any idea where the error lies?

I don't necessarily need the checkbox, I just didn't know how to implement the task differently. In summary, what I plan to do is: If OSM2 layer ( not mandatory ) has not been selected and is therefore empty, download OSM, otherwise use input from OSM2 selected layer for the function Snap points on line.

1 Answer 1

0

I built the model a few times and it behaved the same every time, except for the last time where I set the bool parameter to "check" in the model and then saved. Somehow it has an impact ( or not ? - maybe just a coincidence) and it seems to change an internal setting. I don't have a logical explanation for this because the output from the function "reproject osm2" worked from the beginning ( conditional branch beeing validated, only the following function "Snap points on line" didn't recognize the previous output (@reproject_osm2_OUTPUT) in the if query:

if(@check ,@reproject_osm2_OUTPUT  ,@osm1_OUTPUT)

check

It is not the first time that i witness such an indescribable behavior in an model. Sometimes when using Shortest Path functions and the input from the start or end point is beeing added by expression such as:

attribute(get_feature_by_id(@layer, 1), 'coordinates')

OR

geometry(get_feature_by_id(  @start  ,1)) 

The model is working a few times and then suddenly by mysterious ways is not recognizing the start or end point that is beeing added by expression.

I also found out that when the model is not working anymore and I export it as a python script and compare it to the previous version (that was actually working) there are some differences and some lines in the code are missing. This leads to errors and the shortest path function no longer works as it should.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.