6
votes
Accepted
How to connect nodes via shortest path along network lines with GRASS v.net modules?
I think I found an answer myself.
The problem seems to be the topology of my network file. If I apply v.clean (snap) followed by v.clean (break or bpol), the nodes can be connected via v.net.steiner ...
6
votes
Accepted
Transition Function Inputs
The answer to your question is indeed not obvious from the documentation. In figuring out what the transition function actually refers to, it helps to look into the source code of that function. In ...
5
votes
Accepted
Understanding Contraction Hierarchies
As mentioned on the web page, any order will work, in the sense that the query will find a shortest path. However some orders are much better than others in terms of the time taken to preprocess the ...
5
votes
Shortest path using line layer QGIS
"Shortest path (point to point)" can do what you need. First, all your lines have to be in the same layer. Merge them if needed.
Then, to avoid your error, your lines need to be connected ...
5
votes
Accepted
Shortest path (point to point) in iteration, safe for the case there is no route
Try something like that:
n=0
for f1 in layer1:
p1 = f1.geometry().asPoint()
x1, y1 = p1.x(), p1.y()
coord1= f"{x1},{y1}"
for f2 in layer2:
p2 = f2.geometry()....
5
votes
Shortest paths between points over multiple linestrings
As you already pointed out, this indeed can be solved with pgRouting and will have to be added to your database as an extension. You will have to do some preparations with the data to get it going.
...
4
votes
Shortest path between one point to every other points
NetworkX all_shortest_paths or single_source_dijkstra
You need to calculate all the shortest paths from your source and then summarize edges weights fro every path. Also I'm absolutely sure that ...
4
votes
Shortest path between one point to every other points
You can skip the python part and use the plugin QNEAT3 which is available for QGIS3 (see Distance Matrix with 2 point shapefiles and one street network. It also works in your case offers multiple ...
4
votes
Accepted
Shortest path between one point to every other points
You first need to define what you mean by shortest path. If you don't weight your graph (G), shortest path is simply the path that connects the nodes that passes through the fewest number of other ...
4
votes
Automating the selection of starting points in calculation of Shortest path (point to layer) in QGIS
A solution using the PyQGIS.
Let's assume there are three layers, see the image below:
start points : three red dots in the 'random_points_test' layer
end points : three blue dots in the 'points_test'...
3
votes
Accepted
How to use pgr_dijkstra many-to-many
You don't need the SELECT of the array, just return the array of the SELECT (in other words, remove the "select"):
SELECT * FROM pgr_dijkstraCost(
'select id, source, target, cost, reverse_cost ...
3
votes
Find distances between points through a raster
I am afraid that you will need to create 79 distance rasters with the distance for each point. This can be done in model builder (with iterate features) or with python (loop on the ID with make ...
3
votes
Accepted
Using DTM slope map to find shortest route between two locations using QGIS?
There's a python example in the GDAL/OGR Raster Cookbook (look for 'Least Cost Path analysis'). You'll need to install scikit-image for that.
If using QGIS:-
To get your cost raster, generate a ...
3
votes
Changing way r.cost and r.drain modules work?
I faced the same problem just recently.
And I've found a way of getting a better path. In my case, I was trying to visualise the effect of having the Panama and Suez canals.
My suggestion isn't ...
3
votes
pgrouting calculate length of shortest travel time route
Just addressing the length question here. The pgRouting docs give an example of pgr_kdijkstraPath where the result includes the path geometry. Then you just need to use ST_Length on the output ...
3
votes
Find network distance for multiple origins and destinations?
Take a look at OD Cost Matrix within Network Analyst, sounds like it should work for what you describe you need.
3
votes
Connect points to a line with shortest distance using QGIS?
It is possible to create a line that joins points and line using the Geometry generator.
In the point layer symbology, select the Geometry generator and use this expression to create the shortest ...
3
votes
Accepted
How to calculate the shortest path of adjacent points, from an origin to destination points? (ArcGIS Pro/ArcMap)
The correct way to perform shortest path is to use Travelling Salesman algorithm, ( as per FelixIP comment) - which has been implemented in ArcGIS in the Network Analyst extension.
https://desktop....
3
votes
Accepted
Calculating shortest route by road from one origin point to multiple destination points at once using PostGIS (pgrouting)
You can make use of the dijkstraNear function recently added to pgRouting for one-to-many, many-to-one or many-to-many queries. I have written up a PL/pgSQL function based on some logic of the other ...
3
votes
Accepted
Creating multiple routes with several stops using QGIS
You can use this script: (Reference)
# CHANGE LAYER NAMES
networkLayer = QgsProject.instance().mapLayersByName('networkLayerName')[0]
pointLayer = QgsProject.instance().mapLayersByName('pointLayerName'...
2
votes
Shortest Path Matrix with QGIS/GRASS
NetworkX (http://cheeseshop.python.org/pypi/networkx/) is a Python package with many functions for graph and network analysis. With this package installed you can solve the problem of generating a ...
2
votes
Shortest Path Matrix with QGIS/GRASS
Ok, update after another couple of hours of trying. I think I solved the problem, more or less by accident.
Since I digitized/simplified the grid structure by hand, one of the problems supposedly ...
2
votes
Shortest Path Analysis with Turns in FME?
As the initial message asks for alternative solutions, you can also use FME to upload your data in PostgreSQL/PostGIS and use the pgRouting extension.
There is a specific function pgr_trsp that deals ...
2
votes
Shortest Path Analysis with Turns in FME?
With the current functionality, it is possible, but I don't think you're going to like how!
What you would need is for your network junctions to look like this:
Basically turns become a separate ...
2
votes
Accepted
Finding shortest route between multiple stops using ArcGIS for Android?
The findBestSequence parameter on the RouteParameters class should re-order the stops in the most efficient order (depending on whether you want shortest or fastest route), from the API help :
...
2
votes
Accepted
Shortest Path Analysis - FME
As I'm reading it, the only part you haven't done within FME is to force it only pick stuff within a speed limit.
This is actually very simple.
1) Insert a Tester transformer between your shapefile ...
2
votes
Least cost path with one-off cost for highest elevation
I've found a solution to this, but it requires some brute force.
Find the most cost efficient route, ignoring the cost associated with elevation gain.
Find the maximum elevation of the inital route.
...
2
votes
Selecting layer in Road Graph plugin settings in QGIS?
The QGIS Road Graph Plugin can not use Polyline with Z-values. I solved this problem by removing Z-Values from my polyline shapefile. In QGIS: right mouse click on the layer /Save as... under Geometry ...
2
votes
Using DTM slope map to find shortest route between two locations using QGIS?
I'm not sure about one tool to do that, but if you want to stay in vector routing rather than a cost raster surface as per Steven Kay's answer, you can calculate the slope of your graph edges and use ...
2
votes
Alternative Least Cost Paths
Well, as all LCPA-tools search for the LCP in more or less the same way their results don´t differ a lot. LCPA tools are not looking for random paths between point but for the the path with least ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
shortest-path × 162qgis × 60
pgrouting × 27
arcgis-desktop × 19
network × 19
postgis × 18
network-analyst × 15
dijkstra × 11
qgis-3 × 10
distance × 10
python × 9
algorithm × 9
network-analysis × 9
grass × 8
route × 8
cost-path × 8
postgresql × 7
qgis-plugins × 7
routing × 7
raster × 5
pyqgis × 5
modelbuilder × 5
networkx × 5
r × 4
qgis-modeler × 4