public class GeonamesAPIWrapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GeonamesAPIWrapper.HierarchyRequestPorpertyEnum |
static class |
GeonamesAPIWrapper.SearchRequestPropertyEnum
Enumeration that contains the property definitions used by the LocationEnhancementEngine.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS_GEONAMES_ORG_WEBSERVICE_URL
The geonames.org web service URI allowing anonymous connections.
|
static String |
DEFAULT_GEONAMES_ORG_WEBSERVICE_URL
URI of the geonames.org web services used as default.
|
static String |
HIERARCHY_SERVICE_PATH
Relative path to the hierarchy service
|
protected String |
hierarchyServiceUrl
The access url for the hierarchy service.
|
static String |
SEARCH_SERVICE_PATH
Relative path to the search service
|
protected String |
searchServiceUrl
The access url for the search service.
|
| Constructor and Description |
|---|
GeonamesAPIWrapper()
Initialises a the geonames API wrapper as used for the free service
|
GeonamesAPIWrapper(String serverURL,
String userName,
String token)
Initialise the geonames API wrapper for a given server, username and
token.
|
GeonamesAPIWrapper(String searchService,
String hierarchyService,
String userName,
String token)
Initialise the geonames API wrapper for a given search and hierarchy
service, username and token.
|
| Modifier and Type | Method and Description |
|---|---|
List<Toponym> |
getHierarchy(int geonameId) |
List<Toponym> |
searchToponyms(Map<GeonamesAPIWrapper.SearchRequestPropertyEnum,Collection<String>> parsedParameter) |
List<Toponym> |
searchToponyms(String name) |
public static final String DEFAULT_GEONAMES_ORG_WEBSERVICE_URL
public static final String ANONYMOUS_GEONAMES_ORG_WEBSERVICE_URL
public static final String SEARCH_SERVICE_PATH
public static final String HIERARCHY_SERVICE_PATH
protected String searchServiceUrl
DEFAULT_GEONAMES_ORG_WEBSERVICE_URL+SEARCH_SERVICE_PATH
("http://api.geonames.org/""search")
is used. Users with a premium account including an own sub domain
might need to change this.protected String hierarchyServiceUrl
DEFAULT_GEONAMES_ORG_WEBSERVICE_URL+HIERARCHY_SERVICE_PATH
("http://api.geonames.org/""hierarchy")
is used. Users with a premium account including an own sub domain
might need to change this.public GeonamesAPIWrapper()
public GeonamesAPIWrapper(String serverURL, String userName, String token)
null for any of the parameter will use the
default values. If an empty string is parsed as user name it will be
ignored. Token is only accepted if a valid user name is prased.serverURL - The url of the geonames server to use or null
to use the defaultuserName - The user name to use or null to use the
default. The user name MUST NOT be empty.token - The token to use or null to use the default.
If no valid user name is parsed the token will be ignored.public GeonamesAPIWrapper(String searchService, String hierarchyService, String userName, String token)
null for any of the
parameter will use the default values. If an empty string is parsed as
user name it will be ignored. Token is only accepted if a valid user name
is prased.
The parsed user name and token will be used for both the search and the hierarchy service.
searchService - The url of the search service to use or null
to use the defaulthierarchyService - The url of the hierarchy service to use or
null to use the defaultuserName - The user name to use or null to use the
default. The user name MUST NOT be empty.token - The token to use or null to use the default.
If no valid user name is parsed the token will be ignored.public List<Toponym> searchToponyms(String name) throws IOException
IOExceptionpublic List<Toponym> searchToponyms(Map<GeonamesAPIWrapper.SearchRequestPropertyEnum,Collection<String>> parsedParameter) throws IOException
IOExceptionpublic List<Toponym> getHierarchy(int geonameId) throws IOException
IOExceptionCopyright © 2010–2016 The Apache Software Foundation. All rights reserved.