如何使用node.js提取.gpx数据

发布于 2025-02-12 14:31:09 字数 1993 浏览 0 评论 0原文

我想从Node.js中的GPX文件中提取数据。 (最高海拔,到达/出发时间等)。 我环顾四周,但没有太多信息,我不知道该怎么办。 如果您能告诉我该怎么做,我会很感激。 我是日本人,所以如果我的语法不正确,我深表歉意。 这是一个GPX文件。

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<gpx version="1.1" creator="GPS Visualizer https://www.gpsvisualizer.com/" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
  <name>2021-10-03-XNA-NMQ-01</name>
  <desc>2021-10-03</desc>
  <trkseg>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:22Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:23Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:24Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:25Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:26Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:27Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:28Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1025.0</ele>
      <time>2021-10-03T01:37:29Z</time>
    </trkpt>
--------------------------------------------------------------------------omission
  </trkseg>
</trk>
</gpx>

I would like to extract data from a GPX file in Node.js. (highest altitude, arrival/departure times, etc.).
I have looked around but there is not much information and I don't know what to do.
I would appreciate it if you could tell me what to do.
I am Japanese, so I apologize if my grammar is not correct.
Here is a GPX file.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<gpx version="1.1" creator="GPS Visualizer https://www.gpsvisualizer.com/" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
  <name>2021-10-03-XNA-NMQ-01</name>
  <desc>2021-10-03</desc>
  <trkseg>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:22Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:23Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:24Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:25Z</time>
    </trkpt>
    <trkpt lat="35.5773833" lon="137.41065">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:26Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:27Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1024.0</ele>
      <time>2021-10-03T01:37:28Z</time>
    </trkpt>
    <trkpt lat="35.5774" lon="137.4106667">
      <ele>1025.0</ele>
      <time>2021-10-03T01:37:29Z</time>
    </trkpt>
--------------------------------------------------------------------------omission
  </trkseg>
</trk>
</gpx>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文