Popularity
2.4
Declining
Activity
5.6
Growing
30
3
7

Description

Package go-gpx provides convenince methods for creating and writing GPX documents.

Programming language: Go
License: MIT License
Tags: GIS     Geospatial     GPX    

go-gpx alternatives and similar packages

Based on the "GIS" category.
Alternatively, view go-gpx alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of go-gpx or a related project?

Add another 'GIS' Package

README

go-gpx

GoDoc

Package gpx provides convenince methods for reading and writing GPX documents.

Read example

r := bytes.NewBufferString(`
    <?xml version="1.0" encoding="UTF-8"?>
    <gpx version="1.0" creator="ExpertGPS 1.1 - http://www.topografix.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
        <wpt lat="42.438878" lon="-71.119277">
        <ele>44.586548</ele>
        <time>2001-11-28T21:05:28Z</time>
        <name>5066</name>
        <desc>5066</desc>
        <sym>Crossing</sym>
        <type>Crossing</type>
        </wpt>
    </gpx>
`)
t, err := gpx.Read(r)
if err != nil {
    fmt.Printf("err == %v", err)
    return
}
fmt.Printf("t.Wpt[0] == %+v", t.Wpt[0])
// Output:
// t.Wpt[0] == &{Lat:42.438878 Lon:-71.119277 Ele:44.586548 Time:2001-11-28 21:05:28 +0000 UTC MagVar:0 GeoidHeight:0 Name:5066 Cmt: Desc:5066 Src: Link:[] Sym:Crossing Type:Crossing Fix: Sat:0 HDOP:0 VDOP:0 PDOP:0 AgeOfDGPSData:0 DGPSID:[] Extensions:<nil>}

Write example

g := &gpx.GPX{
    Version: "1.0",
    Creator: "ExpertGPS 1.1 - http://www.topografix.com",
    Wpt: []*gpx.WptType{
        {
            Lat:  42.438878,
            Lon:  -71.119277,
            Ele:  44.586548,
            Time: time.Date(2001, 11, 28, 21, 5, 28, 0, time.UTC),
            Name: "5066",
            Desc: "5066",
            Sym:  "Crossing",
            Type: "Crossing",
        },
    },
}
if _, err := os.Stdout.WriteString(xml.Header); err != nil {
    fmt.Printf("err == %v", err)
}
if err := g.WriteIndent(os.Stdout, "", "  "); err != nil {
    fmt.Printf("err == %v", err)
}
// Output:
// <?xml version="1.0" encoding="UTF-8"?>
// <gpx version="1.0" creator="ExpertGPS 1.1 - http://www.topografix.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
//   <wpt lat="42.438878" lon="-71.119277">
//     <ele>44.586548</ele>
//     <time>2001-11-28T21:05:28Z</time>
//     <name>5066</name>
//     <desc>5066</desc>
//     <sym>Crossing</sym>
//     <type>Crossing</type>
//   </wpt>
// </gpx>

License

MIT


*Note that all licence references and agreements mentioned in the go-gpx README section above are relevant to that project's source code only.