mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:57:08 +00:00
Make EPSG selection subquery more specific.
More of a kludge than a fix. See #56 for a cleaner solution. Closes #55.
This commit is contained in:
@@ -94,14 +94,14 @@ async function saveOnline (dataset, opts = {}) {
|
|||||||
await client.query(`
|
await client.query(`
|
||||||
INSERT INTO raw_shots
|
INSERT INTO raw_shots
|
||||||
(sequence, line, point, objref, tstamp, geometry, hash)
|
(sequence, line, point, objref, tstamp, geometry, hash)
|
||||||
VALUES ($1, $2, $3, $4, $5, ST_SetSRID(ST_MakePoint($6, $7), (SELECT (data->>'epsg')::integer AS epsg FROM file_data)), '*online*')
|
VALUES ($1, $2, $3, $4, $5, ST_SetSRID(ST_MakePoint($6, $7), (SELECT (data->>'epsg')::integer AS epsg FROM file_data WHERE data ? 'id')), '*online*')
|
||||||
ON CONFLICT DO NOTHING;
|
ON CONFLICT DO NOTHING;
|
||||||
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.easting, item.northing]);
|
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.easting, item.northing]);
|
||||||
} else if (item.latitude && item.longitude) {
|
} else if (item.latitude && item.longitude) {
|
||||||
await client.query(`
|
await client.query(`
|
||||||
INSERT INTO raw_shots
|
INSERT INTO raw_shots
|
||||||
(sequence, line, point, objref, tstamp, geometry, hash)
|
(sequence, line, point, objref, tstamp, geometry, hash)
|
||||||
VALUES ($1, $2, $3, $4, $5, ST_Transform(ST_SetSRID(ST_MakePoint($6, $7), 4326), (SELECT (data->>'epsg')::integer AS epsg FROM file_data)), '*online*')
|
VALUES ($1, $2, $3, $4, $5, ST_Transform(ST_SetSRID(ST_MakePoint($6, $7), 4326), (SELECT (data->>'epsg')::integer AS epsg FROM file_data WHERE data ? 'id')), '*online*')
|
||||||
ON CONFLICT DO NOTHING;
|
ON CONFLICT DO NOTHING;
|
||||||
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.longitude, item.latitude]);
|
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.longitude, item.latitude]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user