Questions tagged [pgrouting]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
34 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
  • 781
1 vote
1 answer
18 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
  • 781
0 votes
1 answer
23 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
50 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
2 votes
0 answers
28 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
25 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
80 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
  • 11
0 votes
1 answer
27 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
1 vote
0 answers
22 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
  • 781
0 votes
0 answers
41 views

Is this expected result in pgr_dijkstra?

I have a really dense network of nodes and edges that is based on rasterized version of bathymetric vector data. Every edge has cost which is the distance the edge covers, except in most shallow areas ...
Mikko's user avatar
  • 1
2 votes
0 answers
59 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
187 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
71 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
25 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
52 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
151 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
95 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
62 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
61 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
54 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
282 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
82 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,586
3 votes
1 answer
148 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
32 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
193 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
  • 781
1 vote
1 answer
236 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
  • 898
0 votes
0 answers
46 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
174 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
214 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
118 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
  • 523
2 votes
0 answers
103 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
  • 781
5 votes
2 answers
168 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
93 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
80 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
  • 781
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
  • 781
2 votes
1 answer
187 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
  • 781
2 votes
1 answer
103 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
105 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
  • 781
1 vote
1 answer
231 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
87 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
110 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
152 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
  • 781
1 vote
1 answer
211 views

Accessing pgr_Dijkstra return values, including aggregated cost

I have the following pgr_Dijkstra SQL code for determining the shortest path between two points on a directed water stream network. The results of the query don't give the total_cost or aggregated ...
MJM's user avatar
  • 781
1 vote
1 answer
165 views

pgRouting: How to start path search based on source and target locations in other layers?

I have a line network and two ESRI point shapefiles, where one is the source locations (from_pts) and the other is the target locations(to_pts). I have done the following to prepare my network, but I ...
MJM's user avatar
  • 781
1 vote
1 answer
185 views

pgrouting createTopology error: column source not found!

I tried to create a topology, this is the first steps in pgrouting. I executed select pgr_createTopology('public.line_shapefile', 0.00001, 'geom', 'id'); It returned the following error. seems like ...
sutan's user avatar
  • 898
3 votes
0 answers
110 views

Splitting edges in PostGIS for network analysis

I'm trying to use PostGIS and pgRouting to do some walking distance analysis, using pgr_drivingdistance. I can get this to run without a problem. However, there are only a limited number of nodes on ...
Ddee's user avatar
  • 345
1 vote
1 answer
45 views

Adding direction to undirected graph

What I'm trying to do is traverse a known path in a given direction for a given distance. What I have done so far is build a temp table of the path in the order I want to travel and it looks like: ...
Yendor's user avatar
  • 313
3 votes
1 answer
49 views

Is there a way to penalize or assign cost to transferring edges when routing in pgrouting?

I'm trying to create a routing app for bus routes. I got the network noded and they're all over the place as expected. Running pgr_Dijkstra() returns like 5 bus line, with 8 transfers on a trip. The ...
xyzit's user avatar
  • 41
1 vote
1 answer
38 views

Show intersection POI when getting shortest paths

What I'm trying to do is get K shortest path with details to show all poi that we travel trough. The problem is I'm trying to add intersections to the POI but need to move it off the end of the edge ...
Yendor's user avatar
  • 313
1 vote
0 answers
138 views

Find shortest path between two arbitrary points on a network that's has disconnected edges/ways

I have pre-defined bus routes as directed edges and they're all loops starting and ending on the same point. Sometimes they form a polygon with no intersections with other bus loops and sometimes it ...
xyzit's user avatar
  • 41

1
2 3 4 5
18