Esempio n. 1
0
        static void Sort(string folder, string targetFile)
        {
            var points = Directory.GetFiles(Path.GetFullPath(folder), "*.gpx")
                         .SelectMany(file => GpxFile.Load(file).Tracks)
                         .SelectMany(trk => trk.Segments)
                         .SelectMany(seg => seg.Points)
                         .Distinct();

            var gpx = new GpxFile();

            foreach (var trkpt in points)
            {
                gpx.AddTrackPoint(trkpt);
            }

            gpx.Metadata = new Metadata()
            {
                Name   = "Food & wine cruise, 2018",
                Author = new Person()
                {
                    Name  = "Keith Fletcher",
                    Email = new Email("*****@*****.**"),
                },
                Copyright = new Copyright("Keith Fletcher")
                {
                    Year = 2018
                },
                Time = DateTime.Now
            };

            gpx.Save(targetFile, true);
            Console.WriteLine();
        }
Esempio n. 2
0
        static void Load(string fileName)
        {
            var gpx = GpxFile.Load(fileName);

            gpx.Save("test2.xml");
            Validate("test2.xml");
        }
Esempio n. 3
0
        static void ChangeToRoute()
        {
            var points = GpxFile.Load("Track.gpx")
                         .Tracks
                         .SelectMany(t => t.Segments)
                         .SelectMany(s => s.Points);

            var gpx = new GpxFile();

            foreach (var pt in points)
            {
                gpx.AddRoutePoint(pt);
            }
            gpx.Save("Route.gpx", true);
        }
Esempio n. 4
0
        static void ChangeToWaypoints()
        {
            var points = GpxFile.Load("Track.gpx")
                         .Tracks
                         .SelectMany(t => t.Segments)
                         .SelectMany(s => s.Points);

            var gpx = new GpxFile();
            var i   = 1;

            foreach (var pt in points)
            {
                pt.Name        = $"My waypoint - {i++}";
                pt.Description = $"Desc My waypoint - {i++}";
                gpx.AddWaypoint(pt);
            }
            gpx.Save("Waypoints.gpx", true);
        }