public static void WriteGpxFile(string filePath, GpxDocument doc) { using (GpxWriter gw = new GpxWriter(filePath)) { gw.WriteStartDocument(); gw.WriteStartGpx(); gw.WriteGpxDocument(doc); gw.WriteEndGpx(); gw.WriteEndDocument(); } }
public void WriteGpxDocument(GpxDocument doc) { if (_open && doc != null) { if (doc.Metadata != null) { WriteMetadata(doc.Metadata); } if (doc.Waypoints != null && doc.Waypoints.Count > 0) { foreach (Point point in doc.Waypoints) { WritePoint(point, PointType.WayPoint); } } if (doc.Routes != null && doc.Routes.Count > 0) { foreach (Route route in doc.Routes) { WriteRoute(route); } } if (doc.Tracks != null && doc.Tracks.Count > 0) { foreach (Track track in doc.Tracks) { WriteTrack(track); } } if (doc.Extensions != null) { WriteExtensions(doc.Extensions); } } }