4

I've proceed by this tutorial to create routing topology: Create a Network Topology

They are using osm2pgsql tool for import data and next call pgr_createTopology function.

When I proceed step by stup by this tutorial, and after executing pgr_createTopology, I could not select any route. I find nearest vertices and next I use pgr_dijkstra but I have no result. May be caused it by wrong tolerance which I use?

SELECT pgr_createTopology('planet_osm_roads', 0.00001, 'way', 'osm_id');

At first I try 0.00001, but next 0.001 but still no result. I've tried another datasource, no only osm2pgsql schema and still not works. Which topology should I use if my geometry column is Geometry (Linestring, 900913)?

I can't use osm2pgrouting (RAM is not enough) or osm2po (route is not exact on start and end point).

1

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('public','planet_osm_roads','way');
4326 => 0.00001 in tolerance
ALTER TABLE planet_osm_roads ADD COLUMN "source" integer;
ALTER TABLE planet_osm_roads ADD COLUMN "target" integer;
SELECT pgr_createTopology('planet_osm_roads', 0.00001, 'way', 'osm_id');

Use this to find gaps/dead ends/errors:

SELECT pgr_analyzeGraph('planet_osm_roads', 0.000001, the_geom := 'way', id := 'osm_id');
3

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 1.19 meters away from each other to be connected.

As seen here : https://epsg.io/900913

The system that you're using uses meter as projection unit. Which means that your points have to be less than 0.00001 meters away from each other, which is very low tolerance. ESPG:4326 0.00001 tolerance equals ESPG:900913 1.19 tolerance. I would suggest that you tried increasing the tolerance to this value in order to get better results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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