Package org.geonames

GeoNames Java API main classes.

See:
          Description

Class Summary
Address a street address
Intersection an intersection between two streets
PostalCode a postal code
PostalCodeSearchCriteria search criteria for web services returning postal codes
Run  
StreetSegment a street line segment.
Timezone gmtOffset and dstOffset are computed on the server with the TimeZone and included in the web service as not all geonames users are using java.
Toponym a GeoNames toponym
ToponymSearchCriteria search criteria for web services returning toponyms.
ToponymSearchResult a toponym search result as returned by the geonames webservice.
WeatherObservation  
WebService provides static methods to access the GeoNames web services.
WikipediaArticle a wikipedia article
 

Enum Summary
FeatureClass Enumeration for the GeoNames feature classes A,H,L,P,R,S,T,U,V
Style Enumeration for style parameter specifying the verbosity of geonames web services
 

Exception Summary
GeoNamesException  
InsufficientStyleException Is thrown when trying to access a field that has not been set as the style for the request was not sufficiently verbose to return this information.
InvalidParameterException is thrown when the search criteria is initialized with obviously invalid parameters, such as an invalid country code.
 

Package org.geonames Description

GeoNames Java API main classes.

Webservice Code Examples

geonames full text search

Code Example :
   
  ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
  searchCriteria.setQ("zurich");
  ToponymSearchResult searchResult = WebService.search(searchCriteria);
  for (Toponym toponym : searchResult.toponyms) {
     System.out.println(toponym.getName()+" "+ toponym.getCountryName());
  }



Reverse Geocoding - find next postal codes for given latitude and longitude

Code Example :
   
  PostalCodeSearchCriteria postalCodeSearchCriteria = new PostalCodeSearchCriteria();
  postalCodeSearchCriteria.setLatitude(37.373636);
  postalCodeSearchCriteria.setLongitude(-121.972146);
  List postalCodes = WebService.findNearbyPostalCodes(postalCodeSearchCriteria);