private List<DatosMapa> loadPointListTCX(string folder) { List<DatosMapa> pointList = new List<DatosMapa>(); XmlDocument xDoc = new XmlDocument(); xDoc.Load(folder); XmlNodeList trk = xDoc.GetElementsByTagName("Track"); XmlNodeList lista = ((XmlElement)trk[0]).GetElementsByTagName("Trackpoint"); foreach (XmlElement nodo in lista) { try { // DatosMapa point = new DatosMapa(Convert.ToDouble(nodo["Position"]["LatitudeDegrees"].InnerText.Replace('.', ',')), Convert.ToDouble(nodo["Position"]["LongitudeDegrees"].InnerText.Replace('.', ',')), Convert.ToDouble(nodo["AltitudeMeters"].InnerText.Replace('.', ','))); pointList.Add(point); } catch (Exception) { } } return pointList; }
private List<DatosMapa> loadPointListGPX(string folder) { List<DatosMapa> pointList = new List<DatosMapa>(); XmlDocument xDoc = new XmlDocument(); xDoc.Load(folder); XmlNodeList trk = xDoc.GetElementsByTagName("trk"); XmlNodeList lista = ((XmlElement)trk[0]).GetElementsByTagName("trkpt"); foreach (XmlElement nodo in lista) { try { DatosMapa point = new DatosMapa(Convert.ToDouble(nodo.Attributes["lat"].Value.Replace('.', ',')), Convert.ToDouble(nodo.Attributes["lon"].Value.Replace('.', ',')), Convert.ToDouble(nodo.ChildNodes[0].FirstChild.Value.ToString().Replace('.', ','))); pointList.Add(point); } catch (Exception) { } } return pointList; }