2

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.

enter image description here

The second from visualization in QGIS. enter image description here

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.

4
  • 1
    your first query executes pgr_drivingDistance once for every row in osm_roads_vertices_pgr; it simply fetches the full table, but instead of selecting columns that function will be executed for each row. just omit the FROM 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)
    – geozelot
    Commented Oct 23, 2019 at 13:30
  • I have just added two screenshots.
    – Michal De
    Commented Oct 23, 2019 at 13:54
  • 1
    what's the unit of leng, meter? What happens if you replace it with ST_Length(geom::GEOGRAPHY) AS cost?
    – geozelot
    Commented Oct 23, 2019 at 15:15
  • I have this message: "Only lon/lat coordinate systems are supported in geography." When I delete ":GEOGRAPHY", result is the same. Unit of leng is meter. Coordinates are also in meters (EPSG:2180).
    – Michal De
    Commented Oct 24, 2019 at 18:06

1 Answer 1

1

I found the solution.

My roads network wasn't good splitted. Node 220 had not connection.

I had to use pgr_nodeNetwork.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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