ADSB updates
This commit is contained in:
15
server/src/ais.mjs
Normal file
15
server/src/ais.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
export async function getAIS() {
|
||||
const {ADSB_URL} = cfg();
|
||||
if(!ADSB_URL) return {data: []};
|
||||
const r = await fetch(`${ADSB_URL}:9990/api/ships_array.json`);
|
||||
const j = await r.json();
|
||||
|
||||
const {keys, values} = j;
|
||||
const boats = values.map(row => {
|
||||
const obj = {type: 'vessel'};
|
||||
keys.forEach((key, i) => obj[key] = row[i]);
|
||||
return obj;
|
||||
});
|
||||
|
||||
return boats;
|
||||
}
|
||||
Reference in New Issue
Block a user