toanhoi bui

toanhoi bui

  • NA
  • 70
  • 205.6k

Load google by C

Nov 26 2010 5:16 AM
 XmlDocument doc = new XmlDocument();
                XmlDocument doc1 = new XmlDocument();
                XmlDocument doc2 = new XmlDocument();

                //Get longitude and latitude
                XmlDocument destination1 = new XmlDocument();
                destination1.Load("http://maps.google.com/maps/geo?q=" + comboBox2.Text + "&output=xml");
                XmlNodeList ds1_nodes = destination1.GetElementsByTagName("coordinates");
                string ds1 = null;
                string ds1_destination1 = null;
                ds1 = ds1_nodes[0].ChildNodes.Item(0).InnerText.Trim();
                string[] ds1_strArr = null;
                char[] ds1_splitchar = { ',' };
                ds1_strArr = ds1.Split(ds1_splitchar);
                ds1_destination1 = string.Concat(ds1_strArr[1], ",", ds1_strArr[0]);

                //Get time
                XmlDocument des1 = new XmlDocument();
                string str_des1_1 = null;
                string str_des1_2 = null;
                des1.Load("http://maps.google.com/maps?saddr=" + sr_source + "&daddr=" + ds1_destination1 + "&hl=vi" + "&output=kml");
                XmlNodeList nodes_ds1 = des1.GetElementsByTagName("description");
                str_des1_1 = nodes_ds1[nodes_ds1.Count - 1].ChildNodes.Item(0).InnerText.Trim();
                int i1 = str_des1_1.IndexOf("phu´t");
                str_des1_2 = str_des1_1.Remove(i1);
                char[] splitchar_des1 = { ' ' };
                string[] strArr_des1 = null;