Order preplot points according to incr flag.

Fixes #58.
This commit is contained in:
D. Berge
2020-10-06 16:39:07 +02:00
parent 0c1fde09c6
commit 4b7f544e28

View File

@@ -17,13 +17,16 @@ async function list (projectId, opts = {}) {
last_value(point) OVER w lsp,
count(point) OVER w num_points,
-- ST_MakeLine(first_value(geometry) OVER w, last_value(geometry) over w) geometry,
ST_Distance(first_value(geometry) OVER w, last_value(geometry) over w) length,
ST_Azimuth(first_value(geometry) OVER w, last_value(geometry) over w)*180/pi() azimuth
ST_Distance(first_value(pp.geometry) OVER w, last_value(pp.geometry) over w) length,
ST_Azimuth(first_value(pp.geometry) OVER w, last_value(pp.geometry) over w)*180/pi() azimuth
FROM preplot_points pp
WHERE class = 'V'
INNER JOIN preplot_lines pl USING (line)
WHERE pp.class = 'V'
WINDOW w AS (
PARTITION BY line
ORDER BY point
ORDER BY
CASE WHEN pl.incr THEN point END ASC,
CASE WHEN pl.incr THEN point END DESC
ROWS BETWEEN
UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING