is a libaray to access the webservice of GeoNames
) from a dotnet application. It provides easy to use methods to call the webservice functions and returns dotnet classes.
There is no need to parse xml or anything similar.
Currently only the following webservice calls are supported:
For more information see
Starting point is the class GeoNamesOrgWebservice
that provides static methods. Most methods are returning a single object or a list of the following classes:
// finding some place in Berlin, Germany
// (using prefix m for decimal literals)
Geoname Place = GeoNamesOrgWebservice.FindNearbyPlaceName(52.51m, 13.4m);
// getting all parents
IEnumerable<Geoname> ParentPlaces = Place.Hierarchy();
// display the partents
// (will print out something like: "Globe > Europe > Germany > Land Berlin > Berlin >")
foreach (Geoname x in ParentPlaces)
Console.Write(x.Name + " > ");
A little WinForms applications allows you to call these methods and visualize the data:
Fell free to take a look on the sourcecode.
- Since a webservice is involved every method call can throw exceptions on network errors (e.g. timeouts). You should catch the
WebException to handle these situations.
- Not all Methods provided by the Geonames.org team are implemented yet. Please feel free to contact me or help me with the programming.
- If you need asynchronous access to the webservice you have to handle the threading part yourself. All methods are blocking at the moment.
- You need .NET Framework 3.5 to use GeonamesDotOrgDotNet