Skip to content

neighborhood999/gpx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpx

A simple gpx parser (support Strava currently) for running and written in Go.

Installation

$ make install

Tests

$ make test

Usage

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"

	"github.com/neighborhood999/gpx"
)

func main() {
	f, err := os.Open("running.gpx")

	if err != nil {
		fmt.Println(err)
	}

	defer f.Close()

	b, _ := ioutil.ReadAll(f)
	g, _ := gpx.ReadGPX(bytes.NewReader(b))

	fmt.Println(g.Distance()) // Get the total running distance
	fmt.Println(g.Duration()) // Get the total running duration
	fmt.Println(g.PaceInKM()) // Get the running pace(km/min)
}

LICENSE

MIT © Peng Jie

About

Strava GPX parser written in Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published