项目作者: tkrajina

项目描述 :
GPX library for golang
高级语言: Go
项目地址: git://github.com/tkrajina/gpxgo.git
创建时间: 2014-07-27T19:31:30Z
项目社区:https://github.com/tkrajina/gpxgo

开源协议:Apache License 2.0

下载


Go GPX library

gpxgo is a golang library for parsing and manipulating GPX files. GPX (GPS eXchange Format) is a XML based file format for GPS track logs.

Example:

  1. import (
  2. ...
  3. "github.com/tkrajina/gpxgo/gpx"
  4. ...
  5. )
  6. gpxBytes := ...
  7. gpxFile, err := gpx.ParseBytes(gpxBytes)
  8. if err != nil {
  9. ...
  10. }
  11. // Analyize/manipulate your track data here...
  12. for _, track := range gpxFile.Tracks {
  13. for _, segment := range track.Segments {
  14. for _, point := range segment.Points {
  15. fmt.Print(point)
  16. }
  17. }
  18. }
  19. // (Check the API for GPX manipulation and analyzing utility methods)
  20. // When ready, you can write the resulting GPX file:
  21. xmlBytes, err := gpxFile.ToXml(gpx.ToXmlParams{Version: "1.1", Indent: true})
  22. ...

GPX Compatibility

Gpxgo can read/write both GPX 1.0 and GPX 1.1 files.

GPX extensions support is experimental from v1.1.0 on.

gpxinfo

gpxinfo is a command line utility for writing basic stats from gpx files:

  1. $ go run gpxinfo.go test_files/Mojstrovka.gpx
  2. File: /Users/puzz/golang/src/github.com/tkrajina/gpxgo/test_files/Mojstrovka.gpx
  3. GPX name:
  4. GPX desctiption:
  5. GPX version: 1.0
  6. Author:
  7. Email:
  8. Global stats:
  9. Points: 184
  10. Length 2D: 2.6958067369682577
  11. Length 3D: 3.00439590990862
  12. Bounds: 46.430350, 46.435641, 13.738842, 13.748333
  13. Moving time: 0
  14. Stopped time: 0
  15. Max speed: 0.000000m/s = 0.000000km/h
  16. Total uphill: 446.4893280000001
  17. Total downhill: 417.65524800000026
  18. Started: 1901-12-13 20:45:52 +0000 UTC
  19. Ended: 1901-12-13 20:45:52 +0000 UTC
  20. Track #1:
  21. Points: 184
  22. Length 2D: 2.6958067369682577
  23. Length 3D: 3.00439590990862
  24. Bounds: 46.430350, 46.435641, 13.738842, 13.748333
  25. Moving time: 0
  26. Stopped time: 0
  27. Max speed: 0.000000m/s = 0.000000km/h
  28. Total uphill: 446.4893280000001
  29. ...etc...

History

Gpxgo is based on:

License

gpxgo is licensed under the Apache License, Version 2.0