i am trying to load the elevation (ele tag) from a gpx file and display the values on a chart.
my page takes 12min:12s to load. what is the problem? what i'm making wrong?
here is the file gpx: download
and the code:
please help!
thanks anvanced!
my page takes 12min:12s to load. what is the problem? what i'm making wrong?
here is the file gpx: download
and the code:
| string MyXmlFile = Server.MapPath(".\\Upload\\") + "Tour_2357.xml"; |
| DataSet ds = new DataSet(); |
| XmlDocument xmlDoc = new XmlDocument(); |
| xmlDoc.Load(MyXmlFile); |
| StringBuilder sb = new StringBuilder(); |
| ArrayList sbx=new ArrayList(); |
| XmlNodeList nodes = xmlDoc.GetElementsByTagName("ele"); |
| for (int i = 0; i < nodes.Count; i++) |
| { |
| sbx.Add(nodes.Item(i).ChildNodes[0].InnerText.ToString()); |
| sb.Append(nodes.Item(i).ChildNodes[0].InnerText); |
| sb.Append(Environment.NewLine); |
| } |
| XmlNodeList nodesX = xmlDoc.GetElementsByTagName("trkpt"); |
| latlbl.Text = nodesX.Item(0).Attributes["lat"].Value.ToString(); |
| lonlbl.Text = nodesX.Item(0).Attributes["lon"].Value.ToString(); |
| latlbl1.Text = nodesX.Item(nodesX.Count-1).Attributes["lat"].Value.ToString(); |
| lonlbl1.Text = nodesX.Item(nodesX.Count-1).Attributes["lon"].Value.ToString(); |
| TextBox1.Text = sb.ToString(); |
| RadChart1.DataSource = sbx.ToArray(); |
| RadChart1.DataBind(); |
| foreach (ChartSeries series in RadChart1.Series) |
| { |
| series.DefaultLabelValue = " "; |
| series.Appearance.PointMark.Visible = true; |
| foreach (ChartSeriesItem item in series.Items) |
| { |
| if (item.YValue > 0) |
| { |
| item.ActiveRegion.Tooltip = item.YValue.ToString("F") + " m "; |
| } |
| else if (item.YValue == 0) |
| { |
| item.ActiveRegion.Tooltip = item.YValue.ToString("F") + " m "; |
| } |
| else |
| { |
| item.ActiveRegion.Tooltip = item.YValue.ToString("F") + " m "; |
| } |
| } |
| series.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false; |
| series.PlotArea.XAxis.Appearance.MinorGridLines.Visible = false; |
| series.Appearance.LabelAppearance.RotationAngle = 45; |
| series.Appearance.LabelAppearance.Distance = 10; |
| } |
please help!
thanks anvanced!