4

I'm trying to build a model that will calculate the shortest path from several origins to one destination.

So I have 3 georeferenced vector layers:

  • A line road network
  • A point layer containing terminals
  • A point layer containing a single point representing a mill

My model does a few things to achieve these layers, but I think that is irrelevant for this question.

Now I want to calculate the shortest path from each of the terminals to the mill. If I run the tool outside of the processing modeller its easy peasy, just choosing from the terminal layer to a point I click with the mouse on the map using the tool "Shortests Path (layer to point)". The thing is I want to automate this and in the model tool there is a box for coordinates instead of the mouse clicking part. I want QGIS to read the coordinates from the mill point in the vector layer and insert these in the coordinate box.

Chau
4,5604 gold badges43 silver badges61 bronze badges
asked May 14, 2018 at 11:32
2
  • Welcome to GIS.se! Could you click 'edit' and add some more details about your data? What have you done so far? Commented May 14, 2018 at 13:13
  • I've edit the post to try and make more sense, thank you for the interest so far! Commented May 14, 2018 at 14:11

1 Answer 1

2

You could add a point parameter to your model. Then you'll be able to select that parameter as the End Point in the "Shortest Path (layer to point)" tool. When you run the model, you'll need to define the point every time.

However, it sounds like you're using the same End Point every time you run the model. In that case, you should use a fixed value for the End Point.

To get the coordinates for your point, click on the point with the Identify tool. Expand the "Derived" section, and right click on the X coordinate> copy attribute value. Paste the X value into the model, and repeat for the Y value.

enter image description here

Be sure to enter the coordinates without parentheses, like this: x,y

Not like this: (x,y)

answered May 14, 2018 at 19:05
2
  • Very nice, but I will be running the model with different endpoints. I want the model to define the endpoint automatically. I was thinking there is a way to extract the coordinates from the vector point, put them in point parameter and feed that to the "shortest path (layer to point)"-tool. Any ideas on how to do that? Thank you for your input! Commented May 15, 2018 at 5:55
  • Please edit your question to include information about the endpoint layer. What attributes does it have? Do you want the model to iterate through all the features of the endpoint layer, or only some of them? Commented May 15, 2018 at 17:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.