0

I imported an OSM dataset using osm2pgrouting, and checked the topology like this:

pgr_sfbay=# select pgr_analyzegraph('ways', 0.001, id:='gid');
NOTICE:  PROCESSING:
NOTICE:  pgr_analyzeGraph('ways',0.001,'the_geom','gid','source','target','true')
NOTICE:  Performing checks, please wait ...
NOTICE:  Analyzing for dead ends. Please wait...
NOTICE:  Analyzing for gaps. Please wait...
NOTICE:  Analyzing for isolated edges. Please wait...
NOTICE:  Analyzing for ring geometries. Please wait...
NOTICE:  Analyzing for intersections. Please wait...
NOTICE:              ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE:                    Isolated segments: 2045
NOTICE:                            Dead ends: 115909
NOTICE:  Potential gaps found near dead ends: 99024
NOTICE:               Intersections detected: 11525
NOTICE:                      Ring geometries: 15
 pgr_analyzegraph
------------------
 OK
(1 row)

Then I tried pgr_nodeNetwork() and pgr_createTopology() on the imported table 'ways' and found that the number of isolated segments and gaps are significantly reduced:

pgr_sfbay=# select pgr_analyzegraph('ways_noded', 0.001);
NOTICE:  PROCESSING:
NOTICE:  pgr_analyzeGraph('ways_noded',0.001,'the_geom','id','source','target','true')
NOTICE:  Performing checks, please wait ...
NOTICE:  Analyzing for dead ends. Please wait...
NOTICE:  Analyzing for gaps. Please wait...
NOTICE:  Analyzing for isolated edges. Please wait...
NOTICE:  Analyzing for ring geometries. Please wait...
NOTICE:  Analyzing for intersections. Please wait...
NOTICE:              ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE:                    Isolated segments: 320
NOTICE:                            Dead ends: 27912
NOTICE:  Potential gaps found near dead ends: 11343
NOTICE:               Intersections detected: 47398
NOTICE:                      Ring geometries: 15
 pgr_analyzegraph
------------------
 OK
(1 row)

So I have a few questions:

  1. Why osm2pgrouting gives different results than pgrouting? Does it use the same functions? Or is it because it has some info like overpass that are in the original OSM data?
  2. Is it a good idea to run pgrouting topology functions after osm2pgrouting importing? If so, how to handle the cost, reverse_cost, one_way columns, etc?

For this test I am using mapconfig.xml from GitHub without any changes.

closed as too broad by PolyGeo Dec 24 '17 at 11:19

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

2
  1. 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 and a segment B starts with 5678 there will be a gap 0.0000001 wide

Validity of gaps:

  • maybe if you are routing pedestrians you don't want that gap.
  • maybe if you are routing cars you want that gap.

Sometimes, roads are closed with a small curb, and a pedestrian can cross, but not a car.

pgr_node_network "blindly" "fixes" some of the issues that the graph might have.

2 part 1) Not only importing from using osm2pgrouting, but from any data source analyzing will give you a hint of the quality of your data. And fixing is up to you... for example you don't want "blindly" node the intersections

Intersections detected: 11525

maybe all of them are bridges/tunnels

2 part 2) cost, and reverse_cost can be anything, so you can calculate your own depending on your application requirements.

Not the answer you're looking for? Browse other questions tagged or ask your own question.