Posts

Showing posts from September, 2013

How to Convert Google Maps API V2.0 to V3.0 - A c# overview with code snippet to handle XML Results

C# Code for Geocoding Requests to process XML Output: query should contain post code with country name.  public static Geoloc? LocateGoogle(string query)         {             string url = "http://maps.google.com/maps/api/geocode/xml?address={0}&region=dk&sensor=false";             url = String.Format(url, query);             XmlNode coords = null;             try             {                 string xmlString = GetUrl(url);                 XmlDocument xd = new XmlDocument();                 xd.LoadXml(xmlString);                 XmlNamespaceManager xnm = new XmlNamespaceManager(xd.NameTable);                 //coords = xd.SelectSingleNode("/").ChildNodes[1].ChildNodes[0].ChildNodes[2].LastChild;                 coords = xd.GetElementsByTagName("location")[0];             }             catch { }             Geoloc? gl = null;             if (coords != null)             {                 string lat = coords.ChildNodes[0].InnerXml;                 …