9 votes
Accepted

How are cost and reverse cost computed in pgrouting?

For osm2pgrouting V2.1: length is length of the segment in degree units cost and reverse_cost is the length in degree units. (include the negative values for wrong way) length_m is in meters (there ...
Vicky's user avatar
  • 439
9 votes

Wrong shortest path using pg routing

The two lookup points you pass into the (K)NN sub-queries can't be referenced in EPSG:3857 - their coordinate values seem to be in degree and are likely EPSG:4326! Assuming planet_osm_roads.way has ...
geozelot's user avatar
  • 29.9k
6 votes
Accepted

pgr_dijkstra is considering one-way streets as bidirectional

You are passing in the metric length ST_Length(geom::GEOGRAPHY) of each edge E as both cost & reverse_cost - rendering it equal to to the undirected counterpart. pgRouting realizes ordered graph ...
geozelot's user avatar
  • 29.9k
5 votes

pgr_dijkstra function with geometry column in result

Join to table ways is as for now only solution (BTW recommended in all official documentation and workshops)
Jendrusk's user avatar
  • 2,617
4 votes

pgr_createTopology - how tolerance?

I guess that you took the example createTopology function which is shown for WGS84 geometries, using degrees as a projection unit. 0.00001 degree tolerance means that your points have to be less than ...
Vincent Monteil's user avatar
4 votes
Accepted

How can I get the length of segments from the output of pgr_dijkstra?

pgr_dijkstra(edges_sql, start_vid, end_vid, directed:=true ) is a SQL function. It returns the following, regardless of what you input into its TEXT edges_sql argument. RETURNS SET OF (seq, path_seq,...
raphael's user avatar
  • 3,397
4 votes
Accepted

Using pgRouting for 'multiple pedestrians' on an existing table of 'students'?

It seems that the problem is with the the multi-student sub-query below you were using to replace the single student query: --student (SELECT id FROM osm.osm_ways_vertices_pgr ORDER BY the_geom <-&...
tinlyx's user avatar
  • 11.1k
3 votes
Accepted

OSRM how to use my own map

You have to change the used speed profile (defined in a .lua file) depending on the specific attributes of your edges/ways. By default, car.lua considers edges with common OSM attributes like ...
Mesa's user avatar
  • 1,492
3 votes
Accepted

Cannot create pgr_PointsAsPolygon from pgr_DrivingDistance function?

We mentioned this issue in the pgRouting Practical Guide - http://locatepress.com/pgrouting (still in draft). Hopefully will be fixed in later pgRouting versions. The work around is to do this (as ...
Regina Obe's user avatar
  • 10.5k
3 votes

How to import OpenStreetMap data into GraphX?

Checkout this tool that converts OSM PBFs to Parquet files: https://github.com/adrianulbona/osm-parquetizer .. and the following blogpost containing a demo where Spark is used to reconstruct Way ...
Adrian Bona's user avatar
3 votes

Creating Isochrones - pgr_drivingDistance 2.6 SQL error

so after some manual checking here is a workin answer for people using OSM with the latest versions of the tools (OSM2pgsql and routing 2.62) bascially way.target = route.node SELECT * from ways ...
AK9's user avatar
  • 425
3 votes

What's the correct mapconfig.xml to import railways with osm2pgrouting

That config file looks fine to me. I'd say this is simply an export issue: i.e. overpass-turbo does not keep references between nodes and ways recursively by default - you'd need to explicitly tell it ...
geozelot's user avatar
  • 29.9k
2 votes
Accepted

osm2pgrouting --> option '--conf' cannot be specified more than once

If appears the book that I'm following has either some unreported errata or uses some old syntax. The fix is using --clean with an argument instead of just -clean, which was conflicting with the -c ...
PDX's user avatar
  • 307
2 votes

Topology processing after osm2pgrouting?

osm2pgrouting converts the osm data "as is". In osm segments are defined using sequence of node_ids so for example: (node_id, x, y) (1234, 2, 3.9999999) (5678, 2, 4) if a segment A, ends with 1234 ...
Vicky's user avatar
  • 439
2 votes
Accepted

pgRouting from geocoded user input

The are several loaders for OSM, aimed at different end uses -- routing, rendering with Mapnik, raw format. It can be a somewhat confusing at first to understand the differences, and they all produce ...
John Powell's user avatar
  • 13.6k
2 votes

Changing projection of PostGIS data?

The function used in UpdateGeometrySRID is st_setsrid instead of st_transform. st_setsrid just sets the srid value without changing the coordinates. Since there is no function for looping tables to ...
natsuapo's user avatar
  • 593
2 votes

Strange results in pgRouting

An alternative approach is to NOT select the road segments at all! Working with costs only makes sense in case you have different costs by direction (ie. one way streets), or if you want to make the ...
dkastl's user avatar
  • 4,786
2 votes

Strange results in pgRouting

The newer version of pgRouting from 2.1+ utilizes large numbers rather than negative numbers. Try changing your -1 to something big like 10000.
Regina Obe's user avatar
  • 10.5k
2 votes
Accepted

pgr_createTopology - how tolerance?

Follow this guide to find your tolerance and to create the nessesary columns before running pgr_createTopology: https://workshop.pgrouting.org/2.2.10/en/chapters/topology.html SELECT find_srid('...
Punnerud's user avatar
  • 136
2 votes

osm2pgrouting fails with "cannot open"

osm2pgrouting is a converter function that allows you to import osm data into your postgis database. Instead of changing into a directory called 'osm2pgrouting' (like you are doing above), you should ...
cm1's user avatar
  • 2,270
2 votes
Accepted

pgRouting: How to get other edge attributes

OSM data doesn't necessarily have a valid network topology to be usable with pgRouting. Therefor osm2pgouting fixes the network topology if necessary. It keeps the osm_id for reference, but you ...
dkastl's user avatar
  • 4,786
1 vote

Getting osm2pgrouting working

On Windows; Navigate to your bin file under PostgreSQL directory from CMD and write; osm2pgrouting.exe --f C:\Users\user\Desktop\qgis\export.osm --conf C:\Users\user\Desktop\qgis\mapconfig.xml --...
Capan's user avatar
  • 317
1 vote

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

All pgRouting shortest path functions can do what you want to do. "Shortest" in pgRouting means minimum cost, which every pgRouting function allows you to define. I recommend you the pgRouting ...
dkastl's user avatar
  • 4,786
1 vote
Accepted

Getting closest node point (within 2km) from current location using pgrouting?

You can use pgr_driving_distance function from pgrouting which will calculate for you cost of travel to every edge of topology (every road segment), than you can find nearest route for every point ...
Jendrusk's user avatar
  • 2,617
1 vote

Different databases using different ways to export xml file

2nd approach: use osmnx.core.graph_from_bbox function in python package osmnx to get map and corresponding database, the database contains 4665 lines. OSMnx does not natively produce database output. ...
gboeing's user avatar
  • 181
1 vote

pgrouting OSM data with tolls

When you use osm2pgrouting to import OSM data, then you will find an attribute osm_id in your network table: https://github.com/pgRouting/osm2pgrouting/wiki/Documentation-for-osm2pgrouting-v2.2#table-...
dkastl's user avatar
  • 4,786
1 vote

Dead-ends are connected by osm2pgrouting

Balazs, I've never used QGIS before for downloading OSM data so not sure if it does anything special. Also I'm not sure what area you are downloading to be able to replicate. Can you try using ...
Regina Obe's user avatar
  • 10.5k
1 vote

Using pgRouting for 'multiple pedestrians' on an existing table of 'students'?

The error says, what is wrong: your sub-query returns more than one row: (SELECT id FROM osm.osm_ways_vertices_pgr ORDER BY the_geom <-> (select geom from dpsdata."Geo_Active_Student" ...
dkastl's user avatar
  • 4,786
1 vote
Accepted

Strange results in pgRouting

I will start my answer from osm data. For roads that are not one way (tag: one_way NOT IN (-1, 1), osm2pgrouting considers them as 2 way: Sometimes are real 2 way roads, sometimes are unknown. ...
Vicky's user avatar
  • 439
1 vote

How can I cluster a small area (say a circle of 20 meters diameter) in OSM to check the different node Ids in the area

When using the famous overpass-api, you can have a look at the "around" parameter. See https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL for "around".
stephan75's user avatar
  • 1,109

Only top scored, non community-wiki answers of a minimum length are eligible