Skip to main content

Questions tagged [pgrouting]

pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.

Filter by
Sorted by
Tagged with
1 vote
0 answers
8 views

pgrouting or recursive question?

For a water network, I'd like to count the users and accumulate them. I look at Here's what I've got: and I'd like to get (done by hand): however, with a recursive query, I'm afraid of counting ...
pasqal's user avatar
  • 538
3 votes
1 answer
52 views

Vertices table generated by pgr_createTopology() doesn't have enough vertices

I get 7639 points using st_startpoint and st_endpoint, however the vertices table generated by pgr_createTopology only have 2393 points. The red points are generated by pgr_createTopology, and the ...
Tom's user avatar
  • 31
1 vote
0 answers
47 views

pgr_nodeNetwork returns old_id as int and not bigint

I am using pgr_nodeNetwork('edges', 0.001, 'id', 'geom', 'noded', '', f) to create the paths network. Since the table is being re-generated multiple times the value of old_id in resulting table have ...
postgis-user's user avatar
0 votes
0 answers
48 views

QGIS automate creating equally long routes from a line street layer

I have the task of designing routes within a street line layer that have similar lenght and are designed to drive along each road once. This is for purpose of conducting a survey where each street ...
Gregory C's user avatar
  • 413
1 vote
1 answer
50 views

Cannot cancel pg_routing query in local database

I have tried to cancel the hung query after a pg_routing query, but cannot. I have encountered this problem previously with pg_routing, but ended up really messing up the local database and had to ...
MJM's user avatar
  • 995
2 votes
1 answer
58 views

pgr_createTopology not working is dynamic sql code

I have the following dynamic sql query (left out many lines of code before this, but it works up to the pgr_createTopology element for creating the topology of an extracted stream network based on the ...
MJM's user avatar
  • 995
1 vote
0 answers
52 views

pgrwithpointscost returning empty table

I have a road network and points along the road network that I would like to calculate the distances of the points from beginning to end. Previously @geozelot helped me with a similar problem, but ...
MJM's user avatar
  • 995
1 vote
1 answer
44 views

Using pgRouting function pgr_dijkstraCostMatrix

I am trying to use the pgr_dijkstraCostMatrix function in pgRouting for PostgreSQL to find the shortest paths between points in a road network. However, I keep encountering an error indicating that ...
Zelcon01's user avatar
2 votes
1 answer
78 views

pgr_withPointsCost returns incorrect table values

I have been struggling with getting pgr_withPointsCost to output a correct cost table for months. I have created a routable network, ensured the network is connected, created a poi table with all the ...
MJM's user avatar
  • 995
3 votes
0 answers
78 views

Fixing gaps in line network with pgRouting/PostGIS

I have a line network that I want to fix the gaps on (connect the edges). I have tried the following: SELECT pgr_nodeNetwork('migration.streams', 0.0001, 'id', 'geom'); -- fix gaps and dead ends? ...
MJM's user avatar
  • 995
2 votes
1 answer
33 views

Expected type of geom is integer,smallint or bigint but USER-DEFINED was found

I have tried importing my multilinestring shapefile from both qgis and the shapefile loader into postgis, but it gives me the following error when running the following code: SELECT pgr_createTopology(...
MJM's user avatar
  • 995
0 votes
1 answer
33 views

Create x1,y1,x2,y2 columns of pgRouting a* algorithm from a GeoJSON/shapefile

I have used pgRouting in PostgresSQL to routing using Dijkstra's algorithm. Now I need to do the same with a* algorithm, The A* algorithm needs x1,y1,x2,y2 values instead of geometry. How can I ...
Vignesh M's user avatar
3 votes
0 answers
63 views

Am I using the right version of pg_routing

I am using PostgreSQL 13 (PostgreSQL 13.10 (Debian 13.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit) and when I execute SELECT pgr_full_version(); ...
Athorcis's user avatar
1 vote
0 answers
41 views

Discrepancy in Routing Results Between pgr_TSP Versions (3.1.2 vs. 3.2.1) [closed]

I've been working with the pgr_TSP function in the pgrouting library, and I noticed a change in its behavior between versions 3.1.2 and 3.2.1. Specifically, it seems that in 3.2.1, the algorithm was ...
postgis-user's user avatar
0 votes
0 answers
45 views

Road Restrictions with osm2po

I'm currently using osm2po version 5.5.5 to import data from OpenStreetMap (OSM) into a SQL graph file. My primary concern is to include restrictions on the roads during the import process. To achieve ...
Esdras Assikidana's user avatar
1 vote
0 answers
101 views

How to simplify a segmented line network based on smallest angles at connection points?

I´d like to simplify a network of lines by merging small segments into interconnected compartements. The algorithm should merge the lines based on the smallest cost (degree) at the junction points to ...
mapmap's user avatar
  • 53
0 votes
1 answer
41 views

What is the expected output of pgr_lineGraph()?

I am trying to use pgr_lineGraph() to generate some edge-based catchments from a street network model. My expectation is that pgr_lineGraph() should create a node for every edge in the original graph ...
Nick Bristow's user avatar
2 votes
0 answers
25 views

pgr_withinPointsCost not calculating cost

I had the following SQL query working, but I can't seem to get it working again. In summary, I have a set of points along a stream network that I would like to know the distance of along the stream. ...
MJM's user avatar
  • 995
2 votes
0 answers
77 views

Creating shortest path for a walk mode

I am new to postgis and pgrouting. If you see the attached screenshot, I have loaded the osm data (currently I will be only talking about the walk mode). Here we can see the two layers i.e. ...
Amit Pal's user avatar
  • 121
6 votes
1 answer
226 views

Wrong shortest path using pg routing

I want to find the shortest distance between two coordinates using pg routing. I am using Dijkstra algorithm but the shortest distance is incorrect. The correct value is approx. 6 km but I am getting ...
Piyush Narula's user avatar
3 votes
1 answer
114 views

pg_routing error when generating alpha shapes

When running pg_routing to generate catchment areas I got this error when running the 2 queries below: SQL Error [XX000]: ERROR: parse error - invalid geometry Hint: "se" <-- parse ...
user7993425's user avatar
1 vote
0 answers
47 views

ERROR: column "geom" does not exist Position: 66

I am trying to create an sql view following this pgrouting workshop: https://workshop.pgrouting.org/2.7/en/interactions/chapter-10.html When copying: SELECT ST_MakeLine(route.geom) FROM ( ...
Ayogo's user avatar
  • 221
2 votes
0 answers
70 views

Calling pgr_TSP() function from existing cost matrix table

I am trying to call pgr_TSP() function like below using my existing table which has source_id, target_id and cost details but I am not able to get the result? What should be the syntax for same? ...
postgis-user's user avatar
2 votes
1 answer
221 views

Join a point with adjacent point from list of points in PostGIS

I am creating a grid made up of linestrings by creating a grid and joining the grid points with adjacent grid point but that process is taking too much time. I am using the following query to join the ...
java-user's user avatar
2 votes
1 answer
166 views

What is internal working for pgr_nodeNetwork()?

I am just curious about the list of command being run in the backend when we run SELECT pgr_nodeNetwork() table and SELECT pgr_createTopology(). Also if there is an existing table, will it override ...
java-user's user avatar
2 votes
0 answers
145 views

Problem creating table, duplicate column in query

I am trying to create the following table, but when I execute the query I get the SQL status: 42701, which refers to a duplicate column error (cost column). However, when I run the statement without ...
Alonso Cortés's user avatar
1 vote
1 answer
75 views

how to find Shortest line for a bunch of points(Hamiltonian path) using pgrouting v3.3

it looks like tsp problem. but just as this link describes, I don't want to go back after visiting the last node, so using pgr_tsp returns the wrong answer for me. does pgrouting have any function to ...
c ran's user avatar
  • 11
1 vote
0 answers
74 views

pgr_nodeNetwork doesnt put nodes on every intersection

I used the osmnx python package to get OSM roads network. I intended to use pgr_createTopology to have a correct network in order to use other pgrounting functions. However my data from osm is not ...
Busu's user avatar
  • 136
2 votes
0 answers
301 views

Calculating distance between two points with obstacle using PostGIS

I'm a new user of Postgis, I try to find which point is closer to start_point and end_point. for example: start_point is POINT(19.9948526769673, 0.001437951055402) end_point is POINT(19....
Mathe's user avatar
  • 21
1 vote
1 answer
93 views

pgRouting to create "Loops" with Specific Length

I'm attempting to create an 'optimum' route that starts/ends at the same point and is (close to) X distance long, as opposed to just the absolute optimal route. For example, assuming my cost is a ...
Darren Cope's user avatar
  • 6,636
3 votes
1 answer
281 views

Get all paths between the source and destination nodes in PostGIS using PGRouting extension

How to get all paths between the source and destination nodes in PostGIS using PGRouting extension? I tried the functions: pgr_edgeDisjointPaths: It returns only the Disjoint paths.([40,41,42,45],[40,...
Balakrishnan's user avatar
1 vote
0 answers
41 views

TRSP from / to a two way road

In pgRouting 3.3 function pgr_trsp it was possible to specify the position on the start / end edge instead of just the start / end vertex. This seemed very useful since if the start / end edge is a ...
Salvatierra's user avatar
2 votes
1 answer
228 views

pgr_dijkstra many-to-many invalid memory alloc request size

I am trying to find the shortest path 'from' many locations 'to' many locations. Unfortunately there are many 'from' and 'to' locations which causes pg_dijkstra to fail. For example, I have 97 'from'...
MJM's user avatar
  • 995
1 vote
1 answer
393 views

pgrouting functions does not exist but I installed it

I have a Debian 11 server running with PostgreSQL 13 and PostGIS. I invoked apt to install pgrouting like the following snippet $ # search the package on apt? $ sudo apt update $ apt-cache search ...
sutan's user avatar
  • 941
0 votes
0 answers
63 views

PgRouting Create network isn't splitting on intersections

I've started working with PgRouting, I have a custom road networks inside of a linestring geometry table. I'm currently trying to create a Network for routing, the 70% of the routes are right, but ...
alexdemons2000's user avatar
2 votes
2 answers
291 views

Water Pipeline analysis in PostGIS like Pipe Burst analysis, valves ON/OFF affected areas etc

I have made a network of Water Pipelines with valves of my town, now I want to carry out certain analyses like Pipeline Burst analysis to identify the least number of valves that needed to be turned ...
Chinmay's user avatar
  • 21
2 votes
1 answer
317 views

Optimization of pgr_drivingdistance from pgrouting in PostGIS

I am using pgr_DrivingDistance from pgrouting in PostGIS on a Linux server to calculate isolines of distances from a set given starting points. I include an example below. I have thousands of starting ...
Ddee's user avatar
  • 345
4 votes
1 answer
160 views

Pass a variable parameter to pgr_dijkstra (pgRouting) Edges SQL

I need to pass a parameter to Edges SQL in a pgRouting function, for example pgr_dijkstra. I try something like: PREPARE test (int) AS INSERT INTO elab.test_f SELECT * FROM pgr_dijkstra( 'SELECT id,...
franco_b's user avatar
  • 522
2 votes
0 answers
129 views

Closest location using pgr_withPoints for two points tables

I would like to manually enter the (lat long) value into my sql code that then finds the shortest path via a line network to the closest points from an existing points table. I have been looking at ...
MJM's user avatar
  • 995
5 votes
2 answers
236 views

Calculating cost values in pgRouting using ST_DWithin

I have a table where there are two geometries: geom_way (for routing roads) and (osm_meta) which is a triangulation from polygons. I use ST_DWithin function (between both geometries) with a distance ...
Ferran OA's user avatar
5 votes
2 answers
105 views

Removing certains routes from pgrouting output table

I have used pgRouting to generated multiple many to many traffic routes different points of interest. I have used st_Dwithin to put a catchment area on the routing alogirthm, however the agg_cost(...
Kathryn Adams's user avatar
1 vote
1 answer
113 views

Creating two costs in pgRouting

I am relatively new to SQL and pgRouting. I have the following code to calculate the shortest path from and to multiple points using pgDijkstra. I would like to obtain both an aggregated distance ...
MJM's user avatar
  • 995
0 votes
0 answers
26 views

Locations not picked up by pgrouting

I have some point locations (solid black points) that I am performing network analysis on, but not all of them are being analyzed by pgrouting. The black points with purple rings have been analyzed ...
MJM's user avatar
  • 995
2 votes
1 answer
240 views

pgRouting computation time & code efficiency

I am trying to find the closest landfill by distance from various locations, however, the computation time is 8 hr 36 min to find the shortest path from 3602 locations to 5 landfill locations. Before ...
MJM's user avatar
  • 995
2 votes
1 answer
140 views

Showing Origins on ARRAY multiple routes - pgRouting

I have routed between multiple points using pgRouting. I have aggregated the total cost of each route (length) into a new table using edge = -1 to be imported into an inverse distance weighting ...
Kathryn Adams's user avatar
0 votes
1 answer
122 views

PgRouting shortest path aggregate cost is wrong

I have the following code to determine the shortest route for a set of FROM and TO points along a road network; however, the agg_cost (distance) results are wrong. When I sum the lengths of each line ...
MJM's user avatar
  • 995
1 vote
1 answer
331 views

After pgr_createTopology, how should I use pgr_dijkstra?

Using the OpenStreetMap data and osm2pgsql, I created a topology by using the pgr_createTopology() function. These tables are what I have: List of relations Schema | ...
Chang's user avatar
  • 121
0 votes
0 answers
110 views

Fix geometry to run pgr_createTopology which is very slow and fails

I'm trying to create topology in PostgreSQL using pgr_createTopology but it's very slow and fails after processing 4000 nodes. There are 300,000 nodes. I tried the same query with another road table (...
HumanoVirtual's user avatar
2 votes
0 answers
116 views

Dynamically determine origin and destination points on network lines from nearby features using Pg Routing (pgr_dijkstra)

I am trying to determine the distance along a route from parcel to the nearest fire hydrant using pg_routing and pgr_dijkstra. I have a network table and a nodes table and the following query returns ...
wtgeographer's user avatar
0 votes
1 answer
199 views

Rows with NULL geometry or Null after running pgr_createTopology

After running the code below on a line shapefile that I imported into my postgis database it tells me I have many rows with NULL geometry. I think this might be related to the split with lines ...
MJM's user avatar
  • 995

1
2 3 4 5
18