[pgrouting-dev] Driving Distance

Hi All,

Having a great time with 2.0-develop. Question on pgr_drivingDistance. I added geometry to the test dataset and wrote the following query to return all points within driving distance:

WITH DD AS (
SELECT seq, id1 AS node, cost
FROM pgr_drivingDistance(
‘SELECT id, source, target, cost FROM edge_table’,
7, 1.5, false, false
)
)

SELECT ST_AsText(the_geom)
FROM vertex_table w, DD d
WHERE w.id = d.node
;

A) Am I correct in my usage of this?
B) Am I correct in assuming there is no way (at this time) to return subsets of lines, similar to TSP?

Best,
Steve

Ok so it get's interesting trying to use embed one function within another, for example calculating driving distance and wrapping with alpha shape.

This is as far as I've gotten:

On 06/21/2013 04:07 PM, Stephen Mather wrote:

Hi All,

Having a great time with 2.0-develop. Question on pgr_drivingDistance. I added geometry to the test dataset and wrote the following query to return all points within driving distance:

WITH DD AS (
SELECT seq, id1 AS node, cost
        FROM pgr_drivingDistance(
                'SELECT id, source, target, cost FROM edge_table',
                7, 1.5, false, false
        )

SELECT ST_AsText(the_geom)
    FROM vertex_table w, DD d
    WHERE w.id <http://w.id> = d.node
    ;

A) Am I correct in my usage of this?
B) Am I correct in assuming there is no way (at this time) to return subsets of lines, similar to TSP?

Best,
Steve

_______________________________________________
pgrouting-dev mailing list
pgrouting-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-dev

Ahem, sent before I was done:

WITH DD AS (
SELECT seq, id1 AS node, cost
         FROM pgr_drivingDistance(
                 'SELECT id, source, target, cost FROM edge_table',
                 7, 1.5, false, false
         )
       ),
dd_points AS(
SELECT id, x, y
     FROM vertex_table w, DD d
     WHERE w.id <http://w.id> = d.node
     )
SELECT pgr_alphaShape('SELECT * FROM dd_points');

doesn't work...

ERROR: relation "dd_points" does not exist

I understand why this doesn't work, but I'm not sure how to work around.

On 06/21/2013 04:39 PM, Stephen Mather wrote:

Ok so it get's interesting trying to use embed one function within another, for example calculating driving distance and wrapping with alpha shape.

This is as far as I've gotten:

On 06/21/2013 04:07 PM, Stephen Mather wrote:

Hi All,

Having a great time with 2.0-develop. Question on pgr_drivingDistance. I added geometry to the test dataset and wrote the following query to return all points within driving distance:

WITH DD AS (
SELECT seq, id1 AS node, cost
        FROM pgr_drivingDistance(
                'SELECT id, source, target, cost FROM edge_table',
                7, 1.5, false, false
        )

SELECT ST_AsText(the_geom)
    FROM vertex_table w, DD d
    WHERE w.id <http://w.id> = d.node
    ;

A) Am I correct in my usage of this?
B) Am I correct in assuming there is no way (at this time) to return subsets of lines, similar to TSP?

Best,
Steve

_______________________________________________
pgrouting-dev mailing list
pgrouting-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-dev

A solution of course is to escape the single quotes in the WITH queries, and then embed in the pgr_alphaShape as below. Hope this helps someone:

SELECT pgr_alphaShape('
     WITH DD AS (
     SELECT seq, id1 AS node, cost
         FROM pgr_drivingDistance(
             ''SELECT id, source, target, cost FROM edge_table'',
             7, 1.5, false, false
         )
           ),
     dd_points AS(
     SELECT id, x, y
         FROM vertex_table w, DD d
         WHERE w.id <http://w.id> = d.node
         )
         SELECT * FROM dd_points
     ');

Best,
Steve

On 06/21/2013 04:39 PM, Stephen Mather wrote:

Ahem, sent before I was done:

WITH DD AS (
SELECT seq, id1 AS node, cost
        FROM pgr_drivingDistance(
                'SELECT id, source, target, cost FROM edge_table',
                7, 1.5, false, false
        )
      ),
dd_points AS(
SELECT id, x, y
    FROM vertex_table w, DD d
    WHERE w.id <http://w.id> = d.node
    )
SELECT pgr_alphaShape('SELECT * FROM dd_points');

doesn't work...

ERROR: relation "dd_points" does not exist

I understand why this doesn't work, but I'm not sure how to work around.

On 06/21/2013 04:39 PM, Stephen Mather wrote:

Ok so it get's interesting trying to use embed one function within another, for example calculating driving distance and wrapping with alpha shape.

This is as far as I've gotten:

On 06/21/2013 04:07 PM, Stephen Mather wrote:

Hi All,

Having a great time with 2.0-develop. Question on pgr_drivingDistance. I added geometry to the test dataset and wrote the following query to return all points within driving distance:

WITH DD AS (
SELECT seq, id1 AS node, cost
        FROM pgr_drivingDistance(
                'SELECT id, source, target, cost FROM edge_table',
                7, 1.5, false, false
        )

SELECT ST_AsText(the_geom)
    FROM vertex_table w, DD d
    WHERE w.id <http://w.id> = d.node
    ;

A) Am I correct in my usage of this?
B) Am I correct in assuming there is no way (at this time) to return subsets of lines, similar to TSP?

Best,
Steve

_______________________________________________
pgrouting-dev mailing list
pgrouting-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-dev