mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:57:08 +00:00
29 lines
548 B
JavaScript
29 lines
548 B
JavaScript
|
|
const { sequence } = require('../../../../lib/db');
|
|
|
|
module.exports = async function (req, res, next) {
|
|
|
|
try {
|
|
const json = await sequence.get(req.params.project, req.params.sequence, req.query);
|
|
const geometry = req.query.geometry || "geometrypreplot";
|
|
|
|
const geojson = {
|
|
type: "FeatureCollection",
|
|
features: json.map(feature => {
|
|
return {
|
|
type: "Feature",
|
|
geometry: feature[geometry],
|
|
properties: {...feature}
|
|
}
|
|
})
|
|
};
|
|
|
|
res.status(200).send(geojson);
|
|
next();
|
|
} catch (err) {
|
|
next(err);
|
|
}
|
|
|
|
|
|
};
|