Return full line summary info for raw lines GIS endpoint

This commit is contained in:
D. Berge
2020-08-11 15:38:39 +02:00
parent e4c512f3a2
commit c661a7849a

View File

@@ -41,21 +41,11 @@ async function lines (projectId, options = {}) {
// `;
const text = `
SELECT ST_AsGeoJSON(t.*) geojson
FROM (
SELECT
sequence,
rl.line,
min(tstamp) ts0,
max(tstamp) ts1,
count(point) num_points,
ST_Transform(ST_MakeLine(rs.geometry ORDER BY tstamp), 4326) geometry
FROM raw_lines rl
INNER JOIN raw_shots rs USING (sequence)
GROUP BY sequence
) t;
SELECT ST_AsGeoJSON(rlsg.*) geojson
FROM raw_lines_summary_geometry rlsg;
`;
const res = await pool.query(text);
if (res.rows && res.rows.length) {