[GIS] pgr_createTopology – how tolerance

osm2pgroutingosm2pgsqlosm2popgroutingpostgis

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).

Best Answer

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.

Related Question