UNPKG

geojson2gtfs

Version:

A tiny nodeJs cli app to transform geoJson files (describing an onDemand informal public transport routes) to its corresponding GTFS entities.

21 lines (18 loc) 551 B
const fs = require('fs'); exports.geoJsonFileReader = function(path) { try { return JSON.parse(fs.readFileSync(path)); } catch (error) { throw new Error(`Could not read input file: ${path} \n ${error.message}`); } }; exports.geoJsonFileWriter = function(geoJsonObject, path) { try { const jsonString = JSON.stringify(geoJsonObject, null, "\t"); fs.writeFileSync(path, jsonString); } catch (error) { throw new Error(`Could not write in file: ${path} \n ${error.message}`); } };