static void Main(string[] args) { String GMapPath = args[0]; var map = GMap.Load(new FileStream(GMapPath, FileMode.Open)); map.Save(new FileStream("export.gps", FileMode.Create)); }
static void Main(string[] args) { String GMapPath = args[0]; String KMapPath = args[1]; var map = GMap.Load(new FileStream(GMapPath, FileMode.Open)); foreach (var sec in map.Sections) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("-----------------------"); Console.ResetColor(); foreach (var post in sec.Posts) { Console.WriteLine(post); } } var KMap = new XDocument( new XElement(XName.Get("kml", "http://www.opengis.net/kml/2.2"), new XElement("Document", new XElement("name", "Green Field"), map.Sections.Select(sec => GetRandomStyle(sec)), !args.Contains("/l") ? null : map.Sections.Select(sec => new XElement("Placemark", new XElement("name", "line" + GetStyleName(sec)), new XElement("styleUrl", "#" + GetStyleName(sec)), new XElement("LineString", new XElement("coordinates", string.Join(Environment.NewLine, sec.Posts.Select(p => string.Format(CultureInfo.InvariantCulture.NumberFormat, "{0},{1},0", p.Point.Longitude, p.Point.Latitude))))))), !args.Contains("/k") ? null : map.Sections.SelectMany(sec => sec.Posts.Select(p => new XElement("Placemark", new XElement("name", string.Format("{0} км", p.Ordinate / 1000.0)), new XElement("description", string.Format("{0:N0} м", p.Ordinate)), new XElement("styleUrl", "#" + GetStyleName(sec)), new XElement("Point", new XElement("coordinates", string.Format(CultureInfo.InvariantCulture.NumberFormat, "{0},{1},0", p.Point.Longitude, p.Point.Latitude)))))), !args.Contains("/o") ? null : map.Sections.SelectMany(sec => sec.Posts.SelectMany(p => PositeObjects(sec, p).Select(o => new XElement("Placemark", new XElement("name", string.Format("{1}", o.Object.Ordinate / 1000.0, o.Object.ToString())), new XElement("description", string.Format("{1} на {0:F3} км", o.Object.Ordinate / 1000.0, o.Object.ToString())), new XElement("styleUrl", "#" + GetStyleName(sec)), new XElement("Point", new XElement("coordinates", string.Format(CultureInfo.InvariantCulture.NumberFormat, "{0},{1},0", o.Point.Longitude, o.Point.Latitude))))))) ))); KMap.Save(KMapPath); //Console.ReadLine(); }