mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 13:07:08 +00:00
This commit adds the ability to pack preplot points in Dougal binary format. Sail line points take udv=0 and source line points take udv=1 – udv=2 remains sequence data. Endpoints for retrieving the data in JSON, GeoJSON and binary formats have also been added. Data may be retrieved as a single line or for a whole project.
18 lines
474 B
JavaScript
18 lines
474 B
JavaScript
const { bundle } = require('../../../../lib/binary');
|
|
const { line } = require('../../../../lib/db');
|
|
|
|
module.exports = async function (req, res, next) {
|
|
|
|
try {
|
|
const json = await line.get(req.params.project, req.params.class, req.params.line, {wgs84: true, ...req.query});
|
|
const data = bundle(json, {type: req.params.class == "source" ? 1 : 0});
|
|
console.log("bundle", data);
|
|
|
|
res.status(200).send(Buffer.from(data));
|
|
next();
|
|
} catch (err) {
|
|
next(err);
|
|
}
|
|
|
|
};
|