GeoCode using Yahoo API in C#.NET

bloodyx

New Member
I've got a bit of a issue with csome code that was working properly a few days ago. I'm using Yahoos API to get logitude and latitude for PostCodes the code is below:\[code\]string url = string.Format("http://where.yahooapis.com/geocode?flags=J&appid=xxxx&location={0}", postcode); decimal latitude = 0; decimal longitude = 0; Dictionary<string, decimal> geoCode = new Dictionary<string, decimal>(); dynamic yahooResults = new Uri(url).GetDynamicJsonObject(); foreach (var result in yahooResults.ResultSet.Results) { latitude = (decimal)result.latitude; longitude = (decimal)result.longitude; } geoCode.Add("latitude", latitude); geoCode.Add("longitude", longitude); return geoCode;\[/code\]As I said the code was working fine a few days ago but now logitude and latitude are always returned as 0. I've included the response from Yahoo below:{ "@lang": "en-US", "ResultSet": { "@version": "2.0", "@lang": "en-US", "Error": "0", "ErrorMessage": "No error", "Locale": "en-US", "Found": "1", "Quality": "60", "Result": { "quality": "60", "latitude": "51.62071", "longitude": "-0.23616", "offsetlat": "51.620708", "offsetlon": "-0.23616", "radius": "4200", "name": "", "line1": "", "line2": "London", "line3": "NW7", "line4": "United Kingdom", "house": "", "street": "", "xstreet": "", "unittype": "", "unit": "", "postal": "NW7", "neighborhood": "", "city": "London", "county": "Greater London", "state": "England", "country": "United Kingdom", "countrycode": "GB", "statecode": "ENG", "countycode": "LND", "uzip": "NW7", "hash": "", "woeid": "26787971", "woetype": "11" } }}Sorry for the formatting Stack doesn't seem to want to format it nice! There is clearly a logitiude and latitude returned. I'm sure this is something simple but I can't see it for love nor money, any help would be appreciated.
 
Back
Top