public interface GeoEntryQueryable
GeoEntryQueryable
provides methods for querying a resource containing GeoNames data.Modifier and Type | Method and Description |
---|---|
Optional<String> |
getCountryCode(String wktLocation,
int radius)
Retrieves the country code for the the area defined by
wktLocation in a distance of up
to radius from the coordinate searched. |
List<NearbyLocation> |
getNearestCities(String location,
int radiusInKm,
int maxResults)
Retrieves the cities within
radiusInKm kilometers of metacard , sorted by
population in descending order. |
List<GeoEntry> |
query(String queryString,
int maxResults)
Retrieves the top results for the given query up to
maxResults results. |
List<GeoEntry> query(String queryString, int maxResults) throws GeoEntryQueryException
maxResults
results.queryString
- a String
containing search termsmaxResults
- the maximum number of results to returnList
if no results are foundIllegalArgumentException
- if queryString
is null or empty, or if maxResults
is not a positive integerGeoEntryQueryException
- if an exception occurs while querying the GeoNames resourceList<NearbyLocation> getNearestCities(String location, int radiusInKm, int maxResults) throws ParseException, GeoEntryQueryException
radiusInKm
kilometers of metacard
, sorted by
population in descending order.
Each result is returned as a NearbyLocation
, which describes the position of metacard
relative to the city.
location
- a WKT identifying the area to searchradiusInKm
- the search radius, in kilometersmaxResults
- the maximum number of results to returnmetacard
relative to each of the nearest cities along with the
cities' names, sorted in descending order of populationIllegalArgumentException
- if metacard
is null, or if radiusInKm
or
maxResults
is not a positive integerGeoEntryQueryException
- if an exception occurs while querying the GeoNames resourceParseException
- if an exceptions occurs while parsing location
Optional<String> getCountryCode(String wktLocation, int radius) throws GeoEntryQueryException, ParseException
wktLocation
in a distance of up
to radius
from the coordinate searched.wktLocation
- A WKT locationradius
- the radius in kilometers to search from the given wktLocation
GeoEntryQueryException
ParseException
This work is licensed under a Creative Commons Attribution 4.0 International License.