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:
- 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?
- 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.