@dapia-project/data-converter v4.0.0
Data-Converter
This conversion is for ADS-B data only.\ This library contains several conversion tools for ADS-B messages. We find :
- SBS to JSON
- JSON to SBS
- SBS to NDJSON
- NDJSON to SBS
- CSV Opensky to JSON
- JSON to CSV Opensky
- CSV Opensky to NDJSON
- NDJSON to CSV Opensky
- SBS to CSV Opensky
- CSV Opensky to SBS
- CSV Drone to SBS
- SBS to CSV Drone
- CSV Drone to CSV Opensky
- CSV Opensky to CSV Drone
- CSV Drone to JSON
- JSON to CSV Drone
- CSV Drone to NDJSON
- NDJSON to CSV Drone
Setup
Via NPM
npm i @dapia-project/data-converter
By updating package.json
In your package.json
, add the following:
{
"dependencies": {
"@dapia-project/data-converter": "^4.0.0"
}
}
Initialization
Import SBS to JSON converter:
import { sbsToJson } from '@dapia-project/data-converter/src/sbsToJson'
const jsonData: string = sbsToJson(options)
Import JSON to SBS converter:
import { jsonToSbs } from '@dapia-project/data-converter/src/jsonToSbs'
const sbsData: string = jsonToSbs(options)
Import SBS to NDJSON converter:
import { sbsToNdjson } from '@dapia-project/data-converter/src/sbsToNdjson'
const ndjsonData: string = sbsToNdjson(options)
Import NDJSON to SBS converter:
import { ndjsonToSbs } from '@dapia-project/data-converter/src/ndjsonToSbs'
const sbsData: string = ndjsonToSbs(options)
Import CSV Opensky to JSON converter:
import { openskyCsvToJson } from '@dapia-project/data-converter/src/openskyCsvToJson'
const jsonData: string = openskyCsvToJson(options)
Import JSON to CSV Opensky converter:
import { jsonToOpenskyCsv } from '@dapia-project/data-converter/src/jsonToOpenskyCsv'
const openskyCsvData: string = jsonToOpenskyCsv(options)
Import CSV Opensky to NDJSON converter:
import { openskyCsvToNdjson } from '@dapia-project/data-converter/src/openskyCsvToNdjson'
const ndjsonData: string = openskyCsvToNdjson(options)
Import NDJSON to CSV Opensky converter:
import { ndjsonToOpenskyCsv } from '@dapia-project/data-converter/src/ndjsonToOpenskyCsv'
const openskyCsvData: string = ndjsonToOpenskyCsv(options)
Import CSV Opensky to SBS converter:
import { openskyCsvToSbs } from '@dapia-project/data-converter/src/openskyCsvToSbs'
const sbsData: string = openskyCsvToSbs(options)
Import SBS to CSV Opensky converter:
import { sbsToOpenskyCsv } from '@dapia-project/data-converter/src/sbsToOpenskyCsv'
const openskyCsvData: string = sbsToOpenskyCsv(options)
Import SBS to CSV Drone converter:
import { sbsToDroneCsv } from '@dapia-project/data-converter/src/sbsToDroneCsv'
const droneCsvData: string = sbsToDroneCsv(options)
Import JSON to CSV Drone converter:
import { jsonToDroneCsv } from '@dapia-project/data-converter/src/jsonToDroneCsv'
const droneCsvData: string = jsonToDroneCsv(options)
Import NDJSON to CSV Drone converter:
import { ndjsonToDroneCsv } from '@dapia-project/data-converter/src/ndjsonToDroneCsv'
const droneCsvData: string = ndjsonToDroneCsv(options)
Import CSV Opensky to CSV Drone converter:
import { openskyCsvToDroneCsv } from '@dapia-project/data-converter/src/openskyCsvToDroneCsv'
const droneCsvData: string = openskyCsvToDroneCsv(options)
Import CSV Drone to SBS converter:
import { droneCsvToSbs } from '@dapia-project/data-converter/src/droneCsvToSbs'
const sbsData: string = droneCsvToSbs(options)
Import CSV Drone to JSON converter:
import { droneCsvToJson } from '@dapia-project/data-converter/src/droneCsvToJson'
const jsonData: string = droneCsvToJson(options)
Import CSV Drone to NDJSON converter:
import { droneCsvToNdjson } from '@dapia-project/data-converter/src/droneCsvToNdjson'
const ndjsonData: string = droneCsvToNdjson(options)
Import CSV Drone to CSV Opensky converter:
import { droneCsvToOpenskyCSV } from '@dapia-project/data-converter/src/droneCsvToOpenskyCsv'
const openskyCsvData: string = droneCsvToOpenskyCsv(options)
Options
For all :
key | type | use | default value |
---|---|---|---|
content | String | The content file to convert | |
saveExtraField? | boolean | Choice to have extraField of Format1 in Format2 | false |
Order of fields
For SBS files :
Number | Field |
---|---|
Field 1 | messageType |
Field 2 | transmissionType |
Field 3 | sessionID |
Field 4 | aircraftID |
Field 5 | icao24 |
Field 6 | flightID |
Field 7 | dateMessageGenerated (AAAA/MM/DD) |
Field 8 | timeMessageGenerated (HH:mm:ss.SSS) |
Field 9 | dateMessageLogged (AAAA/MM/DD) |
Field 10 | timeMessageLogged (HH:mm:ss.SSS) |
Field 11 | callsign |
Field 12 | geoaltitude |
Field 13 | groundspeed |
Field 14 | track |
Field 15 | latitude |
Field 16 | longitude |
Field 17 | vertical_rate |
Field 18 | squawk |
Field 19 | alert |
Field 20 | emergency |
Field 21 | spi |
Field 22 | onground |
Field 23 | haveLabel? |
Field 24 | label? |
Field 23 or 25 | extraField? |
\ The HaveLabel and Label fields are not required. But if one is present then so is the other. \ The ExtraField field is a JSON object that contains information present in a converted csv file not present in sbs file. Here is an example:
{
"altitude": "",
"last_position": "",
"lastcontact": "",
"hour": ""
}
You can find information about the SBS format here: http://woodair.net/sbs/Article/Barebones42_Socket_Data.htm \ \ For CSV Opensky files :
The order of the fields below is the order when converting SBS to CSV Opensky. However, the order of fields in a CSV Opensky file during a CSV Opensky to SBS conversion does not follow a certain pattern.
Number | Field |
---|---|
Field 1 | timestamp |
Field 2 | icao24 |
Field 3 | latitude |
Field 4 | longitude |
Field 5 | groundspeed |
Field 6 | track |
Field 7 | vertical_rate |
Field 8 | callsign |
Field 9 | onground |
Field 10 | alert |
Field 11 | spi |
Field 12 | squawk |
Field 13 | altitude |
Field 14 | geoaltitude |
Field 15 | last_position? |
Field 16 | lastcontact? |
Field 17 | hour? |
Field 18 | extraField? |
\ The ExtraField field is a JSON object that contains information present in a converted sbs file not present in csv file. It is not mandatory to add this field when converting. Here is an exemple:
{
"messageType": "",
"transmissionType": "",
"sessionID": "",
"aircraftID": "",
"flightID": "",
"emergency": ""
}
\ \ For CSV Drone files :
Number | Field |
---|---|
Field 1 | name |
Field 2 | icao24 |
Field 3 | date (AAAA-MM-DDTHH:mm:ss.SSSZ) |
Field 4 | fixName |
Field 5 | significantPoint |
Field 6 | timeElapsed |
Field 7 | position.latitude |
Field 8 | position.longitude |
Field 9 | position.altitude |
Field 10 | altitudeMax |
Field 11 | airSpeed |
Field 12 | cas |
Field 13 | mach |
Field 14 | heading |
Field 15 | groundspeed |
Field 16 | distanceToNextWaypoint |
Field 17 | flownDistance |
Field 18 | wind.eastward |
Field 19 | wind.northward |
Field 20 | wind.upward |
Field 21 | route |
Field 22 | mass |
Field 23 | isOneWay |
Field 24 | extraField? |
For JSON and NDJSON files :
Field |
---|
timestamp? |
icao24? |
latitude? |
longitude? |
groundspeed? |
track? |
vertical_rate? |
callsign? |
onground? |
alert? |
spi? |
squawk? |
altitude? |
geoaltitude? |
last_position? |
lastcontact? |
hour? |
messageType? |
transmissionType? |
sessionID? |
aircraftID? |
flightID? |
emergency? |
dateMessageGenerated? |
timeMessageGenerated? |
dateMessageLogged? |
timeMessageLogged? |
haveLabel? |
label? |
name? |
date? |
fixName? |
significantPoint? |
timeElapsed? |
position.latitude? |
position.longitude? |
position.altitude? |
altitudeMax? |
airSpeed? |
cas? |
mach? |
heading? |
distanceToNextWaypoint? |
flownDistance? |
wind.eastward? |
wind.northward? |
wind.upward? |
route? |
mass? |
isOneWay? |
Commands line
You can also run a command line conversion like this:
First, download library globally :
npm i @dapia-project/data-converter -g
Then :
data-converter --file "path/to/fileToConvert.ext" --output "path/to/fileWillBeConvert.ext"
Possible extension types are .sbs
, .csv
, .json
and .ndjson
\
If you wish to convert a file into a Drone CSV file please put the extension .drone.csv
to the output file
3 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
8 months ago
9 months ago
9 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago