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
9 views

How to extract outer roads amongst towns from OSM file and get list of towns [closed]

I need to extract from country OSM file (downloaded at Geofabrik) all inhabitable locations (city, town, village) and calculate shortest distance between two selected locations. In order to minify ...
user avatar
  • 111
3 votes
1 answer
25 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,...
user avatar
  • 503
2 votes
0 answers
46 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 ...
user avatar
  • 203
5 votes
2 answers
69 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 ...
user avatar
0 votes
0 answers
39 views

PgRouting withPoints from point to point

How create points_table for pgr_withPoint function? I know that table must have: pid, edge, fraction, side. For example I have point A(lat,lon) and point B(lat,lon), and I want to get route from A to ...
user avatar
  • 1
5 votes
2 answers
59 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(...
user avatar
1 vote
1 answer
23 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 ...
user avatar
  • 203
0 votes
0 answers
23 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 ...
user avatar
  • 203
2 votes
1 answer
107 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 ...
user avatar
  • 203
2 votes
1 answer
33 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 ...
user avatar
0 votes
1 answer
48 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 ...
user avatar
  • 203
0 votes
0 answers
18 views

Pgrouting : calculate pair shortest path from layers

I want to calculate the shortest path between pair id in 2 layers (origin, destination), like 1 to 1, 2 to 2, etc.... I tried some code but its like one to many and the result is always the same. WITH ...
user avatar
  • 1
0 votes
0 answers
7 views

Finding the shortest path length between two coordinates using pgRouting [duplicate]

Given two pairs of latitude and longitude, how can I find the length of the shortest path, traveled by car? Following the instructions and tutorials from OpenStreetMap, pgRouting, osm2pgsql, ...
user avatar
  • 111
0 votes
1 answer
23 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 | ...
user avatar
  • 111
0 votes
0 answers
26 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 (...
user avatar
2 votes
0 answers
92 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 ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
  • 203
1 vote
1 answer
53 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 ...
user avatar
  • 203
1 vote
1 answer
59 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 ...
user avatar
  • 203
1 vote
1 answer
52 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 ...
user avatar
  • 680
3 votes
0 answers
43 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 ...
user avatar
  • 165
1 vote
1 answer
29 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: ...
user avatar
  • 313
3 votes
1 answer
28 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 ...
user avatar
  • 41
1 vote
1 answer
29 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 ...
user avatar
  • 313
1 vote
0 answers
25 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 ...
user avatar
  • 41
7 votes
3 answers
372 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 ...
user avatar
  • 319
5 votes
2 answers
195 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 ...
user avatar
  • 1,205
0 votes
0 answers
59 views

How to define turn restrictions in pgrouting

I try to make navigation system for calculating the shortest path in Postgres via pgRouting. In my dataset I have roads with all needed attributes (road ID, name, length, oneway…). I have one more ...
user avatar
  • 49
1 vote
0 answers
51 views

PostgreSQL API and QField

Does anyone know how to create a QField API, because I think it's going to work in my case. What I want to achieve is load a heavy PostgreSQL DB on QField (The project contains a lot of tables about ...
user avatar
0 votes
0 answers
34 views

Adding distance threshold to pgrouting script

I have created a loop which produces the shortest distance route between all origins and destinations within a study area. This is essentially showing routes undertaken by motorised transportation as ...
user avatar
0 votes
0 answers
52 views

pgRouting: pgr_TSP starting node

I'm using pgr_TSP to calculate the shortest path between nodes in a road network. In some cases, I give the start vertex id, but in some other cases, I just need the shortest path (best solution) ...
user avatar
  • 55
1 vote
1 answer
64 views

pgRouting ways table attributes description

I've imported an extract of OSM data for my region of interest to Postgresql using osm2pgrouting 2.3.6 in Linux, using mapconfig_for_cars.xml configuration file, and I've found that it created tables ...
user avatar
  • 136
3 votes
1 answer
80 views

pgrouting - pgr_nodeNetwork: Can NOT determine the srid of the geometry "osm_id" IN table

I have been following the guide in order to import PBF data into a PostGIS database: pgrouting - documentation. I have downloaded the Belgium PBF from Geofabrik and installed all extensions needed ...
user avatar
  • 245
2 votes
1 answer
66 views

pgRouting: How to get other edge attributes

I have imported some OSM data in a PostGIS database (using osm2pgrouting) to use with pgRouting. I use Python to send the SQL queries. It works fine, however I noticed that the result includes many ...
user avatar
  • 55
1 vote
0 answers
60 views

PGRouting: build path without shortcuts

I create a pathfinding algorithm using pgrouting library. This is the output I get with pgr_dijkstra: However, I do not need the shortcuts I'm having here. What are the possible approaches to make ...
user avatar
0 votes
1 answer
49 views

How to do pgr_analyzeoneway pgrouting

I try to do pgr_analyzeoneway to my network road data from OSM. But there's some parameter that I don't know what I should input event though already read the example: s_in_rules: text[] source node ...
user avatar
  • 95
2 votes
2 answers
45 views

Distance error with pgr_withPointsCost

Using pgrouting 3.1, I'm getting a error when doing a many to many calculation. I've reduced it to a one to many to try and find out what I'm doing wrong. So with a starting point (green) [33] and end ...
user avatar
  • 313
3 votes
1 answer
52 views

How to count number of attributes and then link back to road network - pgrouting

I have created generated a many-to-many shortest distance route using pgRouting. The output table displays the typical pgRouting outputs (seq, path_seq, edge, node, cost etc.) as well as the road ...
user avatar
2 votes
1 answer
151 views

Location optimisation

I am trying to work out optimal locations of our devices for a given network with a set of placement rules. The main rule is that each device should be within range (i.e. 1000m) of one to two other ...
user avatar
  • 313
2 votes
1 answer
105 views

PGRouting create topology using a subset of a table

I need to create a series of street networks for a neighbourhood in a city. I have used PGRouting before using a whole table to create a topology but I have not been able to do so with only a subset, ...
user avatar
  • 115
0 votes
1 answer
216 views

Problem with Nearest vertex and Shortest Path function in Leaflet

I am a new Leaflet user and I have challenge to get shortest path by pgRouting, GeoServer and Leaflet as a front end application. I followed this tutorial pgRouting + GeoServer + Leaflet JS as a ...
user avatar
  • 1,095
3 votes
1 answer
246 views

Why is pgr_dijkstra not giving shortest path

I am using a road network and the following postgres/postgis operations to perform routing using pg_routing and the pgr_dijkstra method. I am successfully generating routes but they are not the ...
user avatar
0 votes
1 answer
94 views

pgr_dijkstra select shortest path for pairs

I have a a set of start and end nodes in a table best_routes start_vid | end_vid ------------------- 1 | 7 2 | 8 3 | 9 I want to use pgr_dijkstra to create shortest ...
user avatar
1 vote
1 answer
93 views

Finding the path between the point

I'm very new to the PostGIS and QGIS. I'm a student and I am doing thesis work on map matching. I have segment shapefile of two network one OSM network and other one TMC network. And I have point ...
user avatar
2 votes
0 answers
71 views

Why pgr_dijkstra function is faster with directed graph?

I'm doing thousands of tests to get the average route time calculated with the pgr_dijkstra function, taking random nodes. In all tests the average time to generate the routes of the directed graphs (...
user avatar
  • 33
4 votes
1 answer
154 views

Calculate all points in network that are x distance from a starting point in PostGIS with pgrouting

I am trying to write an SQL that calculates all points at a given distance from a point within a network (most likely the wrong term) where the network is stored in a PostgreSQL/PostGIS database as ...
user avatar
  • 313
1 vote
1 answer
126 views

Is the geometry type of PostGIS represented as WKT or just the Point type?

Despite reading a lot of materials on the subject, including the PostGIS manual I still haven't been able to understand, I'm a beginner in this world of geographic objects. I have two tables in my ...
user avatar
  • 33
4 votes
1 answer
144 views

pgr_dijkstra is considering one-way streets as bidirectional

I imported data from a map extracted from OpenStreetMap. With osm2pgrouting I imported it into PostgreSQL, to be worked with pgRouting and PostGIS. Command used: osm2pgrouting -f DIRECTORY/map.osm -d ...
user avatar
1 vote
1 answer
57 views

Closest facilities using Pgr_Withpoint

I am trying to calculate the shortest path's distance from certain locations to their closest schools, I used the Pgr_WithPointsCost Function to get the result from one location to its 10 closest ...
user avatar
  • 93
1 vote
1 answer
49 views

pgr_dijkstra with dynamic IDs

I am trying to use dynamic IDs so I can create a bounding box over the edges. I do have a starting road, which I set up before the query. The closest road_id from a city's coordinates. (i.e. 923342 in ...
user avatar

1
2 3 4 5
18