You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iassure-wx-old/utils/convert-csv-to-json.js

21 lines
483 B

/**
* This script can be used to convert a csv-file to the json format required by the wx-config.json
*
* the csv needs to follow the following format: <FIX>,<LAT>,<LON>
*/
const fs = require('fs');
const points = fs
.readFileSync('./fixes.csv')
.toString()
.split('\n')
.map(str => str.split(','))
.map(data => ({
name: data[0],
lat: Number(data[1]),
lon: Number(data[2]),
}));
fs.writeFileSync('./fixes.json', JSON.stringify(points, undefined, 2));