Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
1 answer
237 views

How to improve shortest path results with Dijkstra/A* on a hexagonal mesh

I am working with traversable polygons and need to calculate the shortest path across them. To do this, I generated a hexagonal mesh over the polygons, extracted the edges, and applied both Dijkstra ...
BR75's user avatar
  • 497
1 vote
1 answer
70 views

Minimum spanning tree (MST) over a set of POINT geometries

I have 3 columns in my table: centerPoint (point), uuid (string), and "areaID". Each areaID can have multiple uuid's, and each uuid has a corresponding centerPoint. I want to calculate the ...
analyst92's user avatar
  • 879
2 votes
0 answers
73 views

Finding shortest line ("arc") traversing a road

Is there any existing method (Qgis plugin, PostGIS etc.) to find the best (shortest) line (arc) to follow in order to traverse a road (represented as polygonal area)? If not, what algorithmic approach ...
michael's user avatar
  • 1,809
7 votes
3 answers
894 views

Calculating shortest route by road from one origin point to multiple destination points at once using PostGIS (pgrouting)

Referring to the below snapshot what is the best possible way to find the road distance from the red star node to all of the yellow nodes using PostGIS. Note: I don't have the road distance data ...
George V's user avatar
  • 339
5 votes
2 answers
1k views

Shortest paths between points over multiple linestrings

I'd like to calculate the distance between one and multiple other points along a network of LineStrings. I'm aware of this question which calculates the distance on a substring of a LineString, but ...
andschar's user avatar
  • 1,255
2 votes
0 answers
694 views

Using shortest path pgr_dijkstra

Versions PostGIS Bundle 3 for PostgreSQL x64 12 pgAdmin 4.24 pgrouting 3.1.0 I have also enabled the postgis and pgrouting extensions on a public schema. I am only just starting with pgrouting so I am ...
pauldanc's user avatar
1 vote
2 answers
803 views

Combining the output of ST_Collect/ST_Union to create linestring from multilinestring?

I am using pgr_dijkstra() to compute the shortest path and then using ST_Collect (or ST_Union) to get the shortest path geometry. However, the collection returned from the ST_Collect is a multi-...
Chintan Pathak's user avatar
2 votes
1 answer
607 views

pgr_dijkstra gives wacky routes sometimes with undirected graph

I am using the function below to find the shortest path between several origin-destination pairs, and it seems to work correctly most of the time. CREATE OR REPLACE FUNCTION public.sp_od( orig ...
Chintan Pathak's user avatar
3 votes
1 answer
438 views

Speed up the shortest distance calculation using pgRouting + PostGIS

I have to calculate the shortest path and corresponding distances for 300k+ origin-destination (OD) pairs. Using the query below it takes me around 0.3 sec to calculate one distance and therefore more ...
Chintan Pathak's user avatar
1 vote
2 answers
199 views

Looping through a table to allocate kids to nearest school

The general problem is to allocate town's kids to their nearest school and get the distance and the geometry. Tools in use is Postgresql 10.6, PostGIS 2.4.3 and PGRouting 2.5.2 There are three ...
hoge6b01's user avatar
  • 1,118
3 votes
2 answers
2k views

Shortest path between cities without duplicate calculation (many-to-many)

I have three tables ==> ways, nodes and cities (OpenStreetMap) ways : Edges with required attributes for routing (source, target, cost, etc.) nodes : Each and every nodes linking the edges cities : ...
BFlat's user avatar
  • 394
3 votes
1 answer
268 views

pgrouting - Choosing an algorithm with a predominance for a specific type of road

I would like to use one of pgrouting's algorithm to find the (shortest) path between 2 points with predominance for a specific type of road. To build the data I used the osm2pgrouting. Is there an ...
user3613919's user avatar
-1 votes
1 answer
2k views

How to calculate shortest path using pgrouting 2.1?

I installed postgresql 9.1.12 & created database "mydb" with user "abc" as below: sudo apt-get install postgresql-9.1 postgresql-9.1-contrib postgresql-9.1-postgis and created databse "mydb". ...
Adithya's user avatar
  • 147
2 votes
0 answers
94 views

Some PostGIS functions explanations [closed]

I'm trying to optimize a route SQL function and playing with some ST_* functions I found around. But even found a good one, I don't want to simply copy/paste what someone wrote. I want to understand ...
Magno C's user avatar
  • 2,190
2 votes
0 answers
304 views

How to find shortest line from a point on a polygon boundary to a multilinestring, but the line is inside polygon (PostGIS)

I have 3 geometries 1 polygon 1 point on boundary 1 multilinestring In this image you can see the problem. I need to find shortest line from point (green square) to line (red), but the line must be ...
José Manuel Mira Martínez's user avatar
2 votes
1 answer
163 views

pgr_ksp() returns other columns from edge table

I'm willing to optimise my queries to make it much faster. In my Edge table, I have different information for each edges (distance, speed, duration, ...). The problem is so far my pgr_ksp() function ...
Rabou's user avatar
  • 31
2 votes
1 answer
3k views

How to use pgr_dijkstra many-to-many

I am using pgr_dijkstra(or pgr_dijkstraCost) to find the shortest path and/or cost for drawing isochrone map. Since I need to calculate the shortest path from each of over 100,000 nodes to multiple ...
lynx's user avatar
  • 23
2 votes
1 answer
815 views

pgrouting calculate length of shortest travel time route

I currently use the pgr_kdijkstraCost() function to calculate the travel times of a few origins and destinations. But I would also like to return the distance length of these trips. Is this possible? ...
Goodbyemoff's user avatar
0 votes
1 answer
551 views

Find shortest path between two points without spatial database

I have an an certain area contains less than 200 roads(polylines), and I need to calculate a shortest path between two specified points inside the area. I know maybe I can use the pgroute in postgis ...
giser's user avatar
  • 803