fix: correctly formatted ads-b exchange data
This commit is contained in:
@@ -29,6 +29,8 @@ export async function getAdbsExchangeData({ lat, lon, radius }) {
|
||||
`http://public-api.adsbexchange.com/VirtualRadar/AircraftList.json?lat=${lat}&lng=${lon}&fDstL=0&fDstU=${radius}`
|
||||
);
|
||||
|
||||
const invalidNumber = /[^0-9.-]/;
|
||||
|
||||
return res.data.acList.map(rec => ({
|
||||
transponder: `${rec.Icao}`.toLowerCase(),
|
||||
callsign: `${rec.Call}`.trim(),
|
||||
@@ -38,11 +40,11 @@ export async function getAdbsExchangeData({ lat, lon, radius }) {
|
||||
location: rec.Lat && rec.Long ? `${rec.Lat},${rec.Long}` : null,
|
||||
lat: rec.Lat,
|
||||
lon: rec.Long,
|
||||
baro_altitude: rec.Alt,
|
||||
geo_altitude: rec.Galt,
|
||||
baro_altitude: rec.Alt.replace(invalidNumber, ''),
|
||||
geo_altitude: rec.Galt.replace(invalidNumber, ''),
|
||||
on_ground: rec.Gnd,
|
||||
velocity: rec.Spd,
|
||||
vertical_rate: rec.Vsi,
|
||||
velocity: rec.Spd.replace(invalidNumber, ''),
|
||||
vertical_rate: rec.Vsi.replace(invalidNumber, ''),
|
||||
squawk: rec.Sqk,
|
||||
spi: false,
|
||||
position_source: positionSourceMap[rec.Trt],
|
||||
|
||||
Reference in New Issue
Block a user