I have the road networks from osm and I created topology.
I know that dijkstra algorithm works, because I calculated the shortest path from two point layers. Now I would like to calculate catchment area for my points (from first layer).
I checked, how works pgr_drivingDistance. The result is far from expected.
I tried these codes:
SELECT pgr_drivingDistance( 'select id, source, target, leng as cost from osm_roads'
, 221, 1000)
FROM osm_roads_vertices_pgr
where 221 is number of nodes. This code executed for a very long time and I had to stop it.
CREATE TABLE distances AS (SELECT a.node AS id, a.agg_cost AS distance, b.the_geom
FROM pgr_drivingDistance(
'SELECT gid AS id, source, target, leng as cost FROM public.osm_roads',
221,
1000
) a, osm_roads_vertices_pgr b WHERE a.node = b.id);
but in this case result had only one point (start point) and this is not true.
I attach two screenshots:
The first, result from PgAdmin.
The second from visualization in QGIS.
What am I doing wrong? Do you have an idea, how can I iprove my code?
I'm using PostgreSQL 10 with PostGIS 2.5.2 and Pgrouting 2.6.2.
pgr_drivingDistance
once for every row inosm_roads_vertices_pgr
; it simply fetches the full table, but instead of selecting columns that function will be executed for each row. just omit theFROM osm_roads_vertices_pgr
. as to your actual issue; without knowing your network, this is impossible to debug (it might just as well be the expected result, and it just needs an explanation as to why it is)leng
, meter? What happens if you replace it withST_Length(geom::GEOGRAPHY) AS cost
?