script berlinmod_datagenerator.sql function createPath seems outdated.
Closed this issue · 1 comments
mitirmizi commented
Setup
pgr_version: 3.6.1
Issue:
As part of my translation of berlinmod generator to python I'm working on the functions in the berlinmod_datagenerator.sql script. When I run the function (link:
)createPath
(to understand it) I get the error:
temp_berlinmod=# select createPath(9598, 4010, 'Fastest Path')
temp_berlinmod-# ;
ERROR: column p.seqno does not exist
LINE 2: SELECT P.seqNo, P.node, P.edge
^
HINT: Perhaps you meant to reference the column "p.seq".
QUERY: WITH Temp1 AS (
SELECT P.seqNo, P.node, P.edge
FROM pgr_dijkstra(query_pgr, sourceN, targetN, true) P
),
Temp2 AS (
SELECT T.seqNo,
-- adjusting directionality
CASE
WHEN T.node = E.sourceNode THEN E.geom
ELSE ST_Reverse(geom)
END AS geom,
maxspeed_forward AS maxSpeed, berlinmod_roadCategory(tag_id) AS category
FROM Temp1 T, Edges E
WHERE edge IS NOT NULL AND E.id = T.edge
)
SELECT array_agg((geom, maxSpeed, category)::step ORDER BY seqNo) FROM Temp2
CONTEXT: PL/pgSQL function createpath(bigint,bigint,text) line 14 at SQL statement
Upon further investigation I also found that indeed the return column for pgr_dijstra in version: 3.6, at least, is seq
and not seqno
.
Also found that use of column sourceNode
in line 345 also give an error:
(psycopg2.errors.InternalError_) Column 'source' not Found
HINT: SELECT id, sourcenode, targetNode AS target,
cost_s AS cost, reverse_cost_s as reverse_cost FROM Edges
CONTEXT: SQL function "pgr_dijkstra" statement 1
It requires the use of source
and target
respectively. I also checked the documentation and the expectations in the errors line up with the documentation. pg_routing documentation: https://docs.pgrouting.org/latest/en/pgr_dijkstra.html
My questions:
- Is this really an error or am I missing something?
- If this is an error can I open a pull request to update this function?