node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »

gpx2json

gpx2json

Simple GPX to JSON converter

Example Code

var gpx2json = require('gpx2json'),
    fs = require('fs');
 
var filename = process.argv[2];
if (!filename) {
    console.log("Param 1 should be a GPX file");
} else {
    fs.stat(filename, function(err, stat) {
        if (err) {
            console.log("Error opening file (" + filename + ")");
            console.log(err.code);
        } else {
            gpx2json.parseGPXFile(filename, function(err, data) {
                console.log(JSON.stringify(data, null, 2));
            });
        }
    });
}