GeoNames Java Client 是通过 REST 服务访问地理数据库 (www.geonames.org) 的 Java 开发包。
示例代码:
ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria(); searchCriteria.setQ("zurich"); ToponymSearchResult searchResult = WebService.search(searchCriteria); for (Toponym toponym : searchResult.getToponyms()) { System.out.println(toponym.getName()+" "+ toponym.getCountryName()); }