public static Geoname Get(string geonameId, string username) { string url = String.Format("http://api.geonames.org/get?geonameId={0}&username={1}&style=full", geonameId, username); Debug.WriteLine("Requesting " + url); string xml = CreateWebClient().DownloadString(url); GeonameException.ThrowOnError(xml); return(new Geoname(xml)); }
public static IList <Geoname> Children(int geonameId, string username, GeoNamesDataStyle style) { string url = String.Format("http://api.geonames.org/children?geonameId={0}&username={1}&style={2}", geonameId, username, style); Debug.WriteLine("Requesting " + url); string xml = CreateWebClient().DownloadString(url); GeonameException.ThrowOnError(xml); return(CreateGeonameList(xml)); }
public static List <Geoname> TextSearch(string searchText, GeoNamesDataStyle style) { //http://api.geonames.org/search?q=london&maxRows=10&username=ffmcoder string url = String.Format("http://api.geonames.org/search?q={0}&maxRows=10&username=ffmcoder&style=full", searchText); Debug.WriteLine("Requesting " + url); string xml = CreateWebClient().DownloadString(url); GeonameException.ThrowOnError(xml); return(CreateGeonameList(xml)); }