DrivingDistance (#19) - Producing driving_distance results (#356) - Message List

Producing driving_distance results

I am trying to get driving distances using pgrouting.

I am able to produce results and plot from the Djikstra algorithm using the following:

DROP TABLE IF EXISTS dijsktra_result;
CREATE TABLE dijsktra_result(gid int4) with oids;
SELECT AddGeometryColumn('dijsktra_result', 'the_geom', '27700', 'MULTILINESTRING', 2);
INSERT INTO dijsktra_result(the_geom)
            SELECT the_geom FROM dijkstra_sp('a_road_polyline', 80970, 62803);

but the following (seemingly analagous) SQL won't produce results for driving_distance.

DROP TABLE IF EXISTS dt_result;
CREATE TABLE dt_result(gid int4) with oids;
SELECT AddGeometryColumn('dt_result', 'the_geom', '27700', 'MULTILINESTRING', 2);
INSERT INTO dt_result(the_geom)
            SELECT the_geom FROM driving_distance('a_road_polyline', 80970, 10.1, false, false);

Instead, I get that

ERROR: column "the_geom" does not exist
SQL state: 42703
Character: 219

I am using Windows XP, Postgres 8.4, pgRouting-1.03_pg-8.3.7.

Thanks in advance for your help and advice.

  • Message #1470

    Do you get a result with

    SELECT the_geom FROM driving_distance('a_road_polyline', 80970, 10.1, false, false);
    

    ?

    • Message #1471

      I do not get a result from that either - it gives the same error.

      I do get a result from

      SELECT * FROM driving_distance('SELECT gid AS id, source, target, length::double precision AS cost FROM a_road_polyline',80970,10.1,false,false);
      

      This convinces me that driving_distance is somehow working, but the result is not of the form that I expected - it is one row that shows vertex_id of 80970, edge_id of 84551, and cost of 0. I was sort of expecting a polyline, or maybe a polygon.

      Maybe I am thinking incorrectly about what driving_distance does?

      • Message #1472

        driving_distance should return you a polygon.

        Are you sure it doesn't return you just your start point at the moment? Maybe the maximum cost is too small to reach the next vertex in your network. What unit is "10.1" in?

        • Message #1473

          "Maybe the maximum cost is too small to reach the next vertex in your network."

          That is a very good point, and if I use 10000 instead of 10.1 as below...

          SELECT * FROM driving_distance('SELECT gid AS id, source, target, length::double precision AS cost FROM a_road_polyline',80970,10000,false,false);
          

          ...I can indeed get a very sensible looking list of 632 rows (with vertex_id, edge_id and cost for each). The units turn out to be meters rather than kilometers as I had expected, so 10.1 was quite a foolish choice.

          I still can't get the_geom from driving_distance, but perhaps there is some way that I can build the_geom from the vertex_id, edge_id, cost pairs?

          Thank you very much for your continued help with this.