mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:57:07 +00:00
Also serve preplot source/sail points as binary.
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.
This commit is contained in:
@@ -5,7 +5,7 @@ module.exports = async function (req, res, next) {
|
||||
|
||||
try {
|
||||
const json = await sequence.get(req.params.project, req.params.sequence, req.query);
|
||||
const data = bundle(json, {type: req.query.type});
|
||||
const data = bundle(json, {type: req.query.type ?? 2});
|
||||
console.log("bundle", data);
|
||||
|
||||
res.status(200).send(Buffer.from(data));
|
||||
|
||||
@@ -7,8 +7,8 @@ module.exports = async function (req, res, next) {
|
||||
const handlers = {
|
||||
"application/json": json,
|
||||
"application/geo+json": geojson,
|
||||
// application/vnd.aaltronav.dougal+octet-stream; format=0x1c
|
||||
"application/vnd.aaltronav.dougal+octet-stream": binary
|
||||
"application/vnd.aaltronav.dougal+octet-stream": binary,
|
||||
"application/vnd.aaltronav.dougal+octet-stream; format=0x1c": binary,
|
||||
};
|
||||
|
||||
const mimetype = (handlers[req.query.mime] && req.query.mime) || req.accepts(Object.keys(handlers));
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = async function (req, res, next) {
|
||||
|
||||
try {
|
||||
const json = await sequence.get(req.params.project, null, req.query);
|
||||
const data = bundle(json, {type: req.query.type});
|
||||
const data = bundle(json, {type: req.query.type ?? 2});
|
||||
console.log("bundle", data);
|
||||
|
||||
res.status(200).send(Buffer.from(data));
|
||||
|
||||
@@ -7,7 +7,8 @@ module.exports = async function (req, res, next) {
|
||||
const handlers = {
|
||||
"application/json": json,
|
||||
"application/geo+json": geojson,
|
||||
"application/vnd.aaltronav.dougal+octet-stream": binary
|
||||
"application/vnd.aaltronav.dougal+octet-stream": binary,
|
||||
"application/vnd.aaltronav.dougal+octet-stream; format=0x1c": binary,
|
||||
};
|
||||
|
||||
const mimetype = (handlers[req.query.mime] && req.query.mime) || req.accepts(Object.keys(handlers));
|
||||
|
||||
Reference in New Issue
Block a user