GeoNames Home | Postal Codes | Download / Webservice | About 
search

GeoNames Source Code

Java Client for GeoNames Webservices

The geonames java library helps you to easily access the geonames web services with java.

Code sample :
  
  WebService.setUserName("demo"); // add your username here
 
  ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
  searchCriteria.setQ("zurich");
  ToponymSearchResult searchResult = WebService.search(searchCriteria);
  for (Toponym toponym : searchResult.getToponyms()) {
     System.out.println(toponym.getName()+" "+ toponym.getCountryName());
  }

Download :
geonames-1.1.12.jar or jar with source code (compiled with java6).
geonames-1.1.12.jar for java5

Requirements :
jdom, used to parse the xml web service result.

License :
This software is released under the Apache License, Version 2.0 (current).

Javadoc :
online javadoc

Doap:
geonames doap



The Java source code for geonames is available on sourceforge. All contributions are welcome.

Release History

13. June 2014, Release 1.1.12: check for GeoNamesException in txt services (timezone,gtopo30,srtm3,astergdem)

15. December 2013, Release 1.1.11: children service now supports maxRows

15. July 2013, Release 1.1.10: multiple country codes supported in toponymsearch, support for proxy, adm5 name and code in search

9. September 2012, Release 1.1.9: implement adm3 name and code for postal code, adm3name and adm4 name for toponym

15. August 2012, Release 1.1.8: add boundingbox parameter to toponym search

18. June 2012, Release 1.1.7: fix issues with https when setting failover server

17. February 2012, Release 1.1.6: switch to failover server after database timeout

8. February 2012, Release 1.1.5: implement "get" service

9. January 2012, Release 1.1.4: examine http status code for failover switch

13. September 2011, Release 1.1.3: improved failover server handling

23. July 2011, Release 1.1.2: fix bug with observationTime for weather services, implemented new service findNearbyStreetsOSM, implement countryBias parameter for search service

25. Feburary 2011, Release 1.1.1: Wikipedia: fix elevation, new rank attribute, new Comparators, new class DistanceOrder; continentCode for Toponym; Bearing returns double

24. January 2011, Release 1.1.0: fix npe for exception handling, Android user agent

20. January 2011, Release 1.0.6: change default server to api.geonames.org, improve exception handling, fix npe with timezone service.

26. November 2010, Release 1.0.5: implement weatherIcao and findNearByWeather, add mtfcc attribute to tiger services, add isReduced to postal code search.

3. April 2010, Release 1.0.4: add continentCode to ToponymSearchCriteria, fix issue with countryCode service

21. January 2010, Release 1.0.3: hierarchy service implemented

10. December 2009, Release 1.0.2: srtm3 multiple coordinates, astergdem new, findNearby, radius for countrycode service

1. June 2009, Release 1.0.1: changed population from 'int' to 'long'.

31. March 2008, Release 1.0 : details

31. August 2007, Release 0.5 : added timezone to Toponym, added style to ToponymSearchResult, add findNearbyStreets fix streetname in findNearestAddress, add adminCode2,3,4, use Enum for featureClass

10. April 2007, Release 0.4 : adminCodes2/3, radius for reverse postal code geocoding

1. Feb 2007, Release 0.3 : Timezone, adminCode1 search

7. Nov 2006, Release 0.2 : Streetlevel reverse geocoding, Bearing

23. Sept 2006, Release 0.1 : initial version (geonames webservice client)



More GeoNames Source Code

GeoRSS module for ROME, a java RSS library.