You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to calculate catchment areas. Doing that, I splitted up my process into two functions.
The first functions identifies the points which can be reached in time. With the second function I want to create polygons, based on driving time.
CREATE OR REPLACE FUNCTION nodes(lon numeric, lat numeric, time integer)
RETURNS void AS
$$
CREATE table nodes_tab AS
SELECT dd.seq, dd.node, dd.cost, dd.agg_cost,
ST_SetSRID(
ST_Point(
ST_X(wvp.the_geom),
ST_Y(wvp.the_geom)), 4326
) as the_geom
FROM pgr_drivingdistance('
SELECT gid AS id,
source,
target,
CASE
WHEN some_f(a) = -1.0
THEN -1.0
ELSE cost_s END
AS cost,
reverse_cost_s AS reverse_cost
FROM ways',
pgr_pointToEdgeNode('ways', ST_SetSRID(
ST_Point($1, $2),
4326), 0.01
),
$3,
directed := true) AS dd INNER JOIN
ways_vertices_pgr
AS wvp
ON dd.node = wvp.id;
$$
language 'sql';
SELECT pgr_pointsAsPolygon(
'cnt.seq AS id,
ST_X(cnt.the_geom) AS x,
ST_Y(cnt.the_geom) AS y')
FROM nodes_tab cnt;
That throws me an error I do not even understand:
ERROR: syntax error at or near "cnt"
LINE 1: cnt.seq AS id,
^
QUERY: cnt.seq AS id,
ST_X(cnt.the_geom) AS x,
ST_Y(cnt.the_geom) AS y
CONTEXT: PL/pgSQL function pgr_pointsaspolygon(character varying,double precision) line 17 at FOR over EXECUTE statement
********** Error **********
ERROR: syntax error at or near "cnt"
SQL state: 42601
Context: PL/pgSQL function pgr_pointsaspolygon(character varying,double precision) line 17 at FOR over EXECUTE statement
@cvvergara and again: Thank you :)
Thanks for pointing the pgr_pointToEdgeNode() problem out. The authors of this book http://locatepress.com/pgrouting recommended using it...
pgr_pointsAsPolygon has has been depracated on version 3.0.0
and pgr_alphaShape has been rewritten on v3.0.0
Please consider that this function will eventually be removed from pgRouting and moved to PostGIS.
I want to calculate catchment areas. Doing that, I splitted up my process into two functions.
The first functions identifies the points which can be reached in time. With the second function I want to create polygons, based on driving time.
The created table is correct.
Then I want to create polygons, based on the points.
Doing that I use the
pointsaspolygons
function http://docs.pgrouting.org/latest/en/src/alpha_shape/doc/pgr_pointsAsPolygon.html#pgr-points-as-polygonThat throws me an error I do not even understand:
At the first glance one could think that this is related to this error:
http://gis.stackexchange.com/questions/215203/cannot-create-pgr-pointsaspolygon-from-pgr-drivingdistance-function/215218#215218
However, I am not using a nested query with quotes...
Note: I asked here as well if this behaviour is known: http://gis.stackexchange.com/questions/221794/cannot-create-polygon-from-points
The text was updated successfully, but these errors were encountered: