I have a requirement to geocode data using Google's geocoding service. Google's geocoding services aren't as friendly to consumption via .NET as, say Bing's (no surprise there) so while I could go all out with ContractDataSerializers
, WCF, JSON and a whole other pile of acronyms is there anything wrong with something like the below if all I need is, say, latitude and longitude viz.
string url = String.Format("http://maps.google.com/maps/api/geocode/xml?address=blah&region=ie&sensor=false", HttpUtility.UrlEncode(address));
Coordinates returnValue = new Coordinates();
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(url);
XmlNodeList xmlNodeList = xmlDocument.SelectNodes("/GeocodeResponse/result");
if (xmlNodeList != null)
{
// Do something here with the information
}
Other than a lot of upfront development effort what precisely will the other approach buy? I am very comfortable with WCF, DataContracts, ServiceContracts etc. but I can't see what they'll bring to the table here...