C# Gpx Reader/Writer

GpxReader parses gpx files formatting with http://www.topografix.com/GPX/1/1 schema. Some additions provided by http://www.garmin.com/xmlschemas/GpxExtensions/v3 schema is also supported.

Following sample code copying gpx form input to output:

using (GpxReader reader = new GpxReader(input))
{
    using (GpxWriter writer = new GpxWriter(output))
    {
        while (reader.Read())
        {
            switch (reader.ObjectType)
            {
                case GpxObjectType.Metadata:
                    writer.WriteMetadata(reader.Metadata);
                    break;
                case GpxObjectType.WayPoint:
                    writer.WriteWayPoint(reader.WayPoint);
                    break;
                case GpxObjectType.Route:
                    writer.WriteRoute(reader.Route);
                    break;
                case GpxObjectType.Track:
                    writer.WriteTrack(reader.Track);
                    break;
            }
        }
    }
}

Download source code.