Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
How to extract trkpt object information from GPX Parser.js in Node.js

First of all I am Japanese. I am posting this using a translation, so if there is anything wrong with the grammar, please feel free to ask me questions. I am looking to create a system that reads GPX files in Node.js and reads and displays the highest altitude, arrival and departure times, etc. from the GPX files.

app.get('/test_gpx' , (req, res) => {
  const file = fs.createWriteStream("file.gpx");
  http.get("filepath", response => {
  response.pipe(file);
  const fs = require("fs");

  const stream = fs.createReadStream("./file.gpx", {
                    encoding: "utf8",         
                    highWaterMark: 1024       
                });

  let count = 0;    
  let total = 0;
  let chunk;
  global.variable_chunk;

  stream.on("readable", () => {
    while ( ( chunk = stream.read()) !== null ) {
      count++;
      total +=  chunk.length;
      global.variable_chunk = global.variable_chunk + chunk;
    }
  });
  stream.on("end", () => {
    
    console.log(`The data was obtained in ${count} installments.`);
    console.log(`Total ${total} bytes acquired.`);
    var gpx = new gpxParser();
    console.log(global.variable_chunk); 
    gpx.parse(global.variable_chunk); 
    var track = gpx;
    console.log(track)
  });
});
});

Lines 2 through 27 are the process of reading GPX files with fs and storing them in variables. npm uses GPX Parser.js. I don't know how to extract the information of the trkpt object because there is not much information in official tutorials etc. If anyone knows anything about this, I would appreciate it if you could enlighten me.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda