Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda