public class WebService extends java.lang.Object
Note : values for some fields are only returned with sufficient Style
. Accessing these fields (admin codes and admin names, elevation,population)
will throw an InsufficientStyleException
if the Style
was not
sufficient.
Constructor and Description |
---|
WebService() |
Modifier and Type | Method and Description |
---|---|
static Address |
address(double latitude,
double longitude) |
static int[] |
astergdem(double[] latitude,
double[] longitude) |
static int |
astergdem(double latitude,
double longitude) |
static ToponymSearchResult |
children(int geonameId,
java.lang.String language,
Style style)
returns the children in the administrative hierarchy of a toponym.
|
static ToponymSearchResult |
children(int geonameId,
java.lang.String language,
Style style,
int maxRows) |
static java.lang.String |
countryCode(double latitude,
double longitude)
The iso country code of any given point.
|
static java.lang.String |
countryCode(double latitude,
double longitude,
double radius)
The iso country code of any given point with radius for coastal areas.
|
static CountrySubdivision |
countrySubdivision(double latitude,
double longitude,
double radius,
int level,
java.lang.String lang) |
static java.util.List<Toponym> |
findNearby(double latitude,
double longitude,
double radius,
FeatureClass featureClass,
java.lang.String[] featureCodes,
java.lang.String language,
int maxRows)
Based on the following inforamtion: Webservice Type : REST
api.geonames.org/findNearbyWikipedia?
|
static java.util.List<Toponym> |
findNearby(double latitude,
double longitude,
FeatureClass featureClass,
java.lang.String[] featureCodes) |
static java.util.List<Toponym> |
findNearbyPlaceName(double latitude,
double longitude)
convenience method for
findNearbyPlaceName(double,double,double,int) |
static java.util.List<Toponym> |
findNearbyPlaceName(double latitude,
double longitude,
double radius,
int maxRows) |
static java.util.List<PostalCode> |
findNearbyPostalCodes(PostalCodeSearchCriteria postalCodeSearchCriteria)
returns a list of postal codes
|
static java.util.List<StreetSegment> |
findNearbyStreets(double latitude,
double longitude,
double radius) |
static java.util.List<StreetSegment> |
findNearbyStreetsOSM(double latitude,
double longitude,
double radius) |
static WeatherObservation |
findNearByWeather(double latitude,
double longitude) |
static java.util.List<WikipediaArticle> |
findNearbyWikipedia(double latitude,
double longitude,
double radius,
java.lang.String language,
int maxRows)
Based on the following inform: Webservice Type : REST
api.geonames.org/findNearbyWikipedia?
|
static java.util.List<WikipediaArticle> |
findNearbyWikipedia(double latitude,
double longitude,
java.lang.String language) |
static Address |
findNearestAddress(double latitude,
double longitude)
for US only
|
static Intersection |
findNearestIntersection(double latitude,
double longitude) |
static Intersection |
findNearestIntersection(double latitude,
double longitude,
double radius) |
static Address |
geoCodeAddress(java.lang.String q,
java.lang.String country,
java.lang.String postalcode) |
static Toponym |
get(int geoNameId,
java.lang.String language,
java.lang.String style) |
static int |
getConnectTimeOut() |
static Style |
getDefaultStyle() |
static java.lang.String |
getGeoNamesServer() |
static java.lang.String |
getGeoNamesServerFailover() |
static java.net.Proxy |
getProxy() |
static int |
getReadTimeOut() |
static java.lang.String |
getToken() |
static java.lang.String |
getUserName() |
static int |
gtopo30(double latitude,
double longitude)
GTOPO30 is a global digital elevation model (DEM) with a horizontal grid
spacing of 30 arc seconds (approximately 1 kilometer).
|
static java.util.List<Toponym> |
hierarchy(int geonameId,
java.lang.String language,
Style style)
returns the hierarchy for a geonameId
|
static boolean |
isAndroid() |
static ToponymSearchResult |
neighbours(int geonameId,
java.lang.String language,
Style style)
returns the neighbours of a toponym.
|
static java.lang.String |
ocean(double latitude,
double longitude) |
static java.util.List<PostalCode> |
postalCodeSearch(PostalCodeSearchCriteria postalCodeSearchCriteria)
returns a list of postal codes for the given search criteria matching a full
text search on the GeoNames postal codes database.
|
static java.util.List<PostalCode> |
postalCodeSearch(java.lang.String postalCode,
java.lang.String placeName,
java.lang.String countryCode)
returns a list of postal codes for the given parameters.
|
static void |
saveTags(java.lang.String[] tags,
Toponym toponym,
java.lang.String username,
java.lang.String password) |
static ToponymSearchResult |
search(java.lang.String q,
java.lang.String countryCode,
java.lang.String name,
java.lang.String[] featureCodes,
int startRow)
convenience method for
search(ToponymSearchCriteria) |
static ToponymSearchResult |
search(java.lang.String q,
java.lang.String countryCode,
java.lang.String name,
java.lang.String[] featureCodes,
int startRow,
java.lang.String language,
Style style,
java.lang.String exactName)
convenience method for
search(ToponymSearchCriteria)
The string fields will be transparently utf8 encoded within the call. |
static ToponymSearchResult |
search(ToponymSearchCriteria searchCriteria)
full text search on the GeoNames database.
|
static void |
setConnectTimeOut(int connectTimeOut) |
static void |
setDefaultStyle(Style defaultStyle) |
static void |
setGeoNamesServer(java.lang.String pGeoNamesServer)
sets the server name for the GeoNames server to be used for the requests.
|
static void |
setGeoNamesServerFailover(java.lang.String geoNamesServerFailover)
sets the default failover server for requests in case the main server is not
accessible.
|
static void |
setProxy(java.net.Proxy proxy) |
static void |
setReadTimeOut(int readTimeOut) |
static void |
setToken(java.lang.String token)
sets the token to be used to authenticate the requests.
|
static void |
setUserName(java.lang.String userName)
Sets the user name to be used for the requests.
|
static int[] |
srtm1(double[] latitude,
double[] longitude) |
static int |
srtm1(double latitude,
double longitude) |
static int[] |
srtm3(double[] latitude,
double[] longitude) |
static int |
srtm3(double latitude,
double longitude)
Shuttle Radar Topography Mission (SRTM) elevation data.
|
static Timezone |
timezone(double latitude,
double longitude)
get the timezone for a given location
|
static WeatherObservation |
weatherIcao(java.lang.String icaoCode) |
static java.util.List<WikipediaArticle> |
wikipediaSearch(java.lang.String q,
java.lang.String language)
full text search on geolocated wikipedia articles.
|
static java.util.List<WikipediaArticle> |
wikipediaSearchForTitle(java.lang.String title,
java.lang.String language)
full text search on geolocated wikipedia articles.
|
public WebService()
public static boolean isAndroid()
public static java.util.List<PostalCode> postalCodeSearch(java.lang.String postalCode, java.lang.String placeName, java.lang.String countryCode) throws java.lang.Exception
postalCode
- placeName
- countryCode
- java.lang.Exception
public static java.util.List<PostalCode> postalCodeSearch(PostalCodeSearchCriteria postalCodeSearchCriteria) throws java.lang.Exception
postalCodeSearchCriteria
- java.lang.Exception
public static java.util.List<PostalCode> findNearbyPostalCodes(PostalCodeSearchCriteria postalCodeSearchCriteria) throws java.lang.Exception
postalCodeSearchCriteria
- java.lang.Exception
public static java.util.List<Toponym> findNearbyPlaceName(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
findNearbyPlaceName(double,double,double,int)
latitude
- longitude
- java.io.IOException
java.lang.Exception
public static java.util.List<Toponym> findNearbyPlaceName(double latitude, double longitude, double radius, int maxRows) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static java.util.List<Toponym> findNearby(double latitude, double longitude, FeatureClass featureClass, java.lang.String[] featureCodes) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static java.util.List<Toponym> findNearby(double latitude, double longitude, double radius, FeatureClass featureClass, java.lang.String[] featureCodes, java.lang.String language, int maxRows) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static Toponym get(int geoNameId, java.lang.String language, java.lang.String style) throws java.io.IOException, java.lang.Exception
geoNameId
- language
- - optionalstyle
- - optionaljava.io.IOException
java.lang.Exception
public static Address findNearestAddress(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
latitude
- longitude
- java.io.IOException
java.lang.Exception
public static Intersection findNearestIntersection(double latitude, double longitude) throws java.lang.Exception
java.lang.Exception
public static Intersection findNearestIntersection(double latitude, double longitude, double radius) throws java.lang.Exception
java.lang.Exception
public static java.util.List<StreetSegment> findNearbyStreets(double latitude, double longitude, double radius) throws java.lang.Exception
latitude
- longitude
- radius
- java.lang.Exception
public static java.util.List<StreetSegment> findNearbyStreetsOSM(double latitude, double longitude, double radius) throws java.lang.Exception
java.lang.Exception
public static Address address(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static Address geoCodeAddress(java.lang.String q, java.lang.String country, java.lang.String postalcode) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static ToponymSearchResult search(java.lang.String q, java.lang.String countryCode, java.lang.String name, java.lang.String[] featureCodes, int startRow) throws java.lang.Exception
search(ToponymSearchCriteria)
q
- countryCode
- name
- featureCodes
- startRow
- java.lang.Exception
public static ToponymSearchResult search(java.lang.String q, java.lang.String countryCode, java.lang.String name, java.lang.String[] featureCodes, int startRow, java.lang.String language, Style style, java.lang.String exactName) throws java.lang.Exception
search(ToponymSearchCriteria)
The string fields will be transparently utf8 encoded within the call.q
- search over all fieldscountryCode
- name
- search over name onlyfeatureCodes
- startRow
- language
- style
- exactName
- java.lang.Exception
public static ToponymSearchResult search(ToponymSearchCriteria searchCriteria) throws java.lang.Exception
searchCriteria
- java.lang.Exception
ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria(); searchCriteria.setQ("zürich"); ToponymSearchResult searchResult = WebService.search(searchCriteria); for (Toponym toponym : searchResult.toponyms) { System.out.println(toponym.getName() + " " + toponym.getCountryName()); }
public static ToponymSearchResult children(int geonameId, java.lang.String language, Style style) throws java.lang.Exception
geonameId
- language
- style
- java.lang.Exception
public static ToponymSearchResult children(int geonameId, java.lang.String language, Style style, int maxRows) throws java.lang.Exception
geonameId
- language
- style
- maxRows
- java.lang.Exception
public static ToponymSearchResult neighbours(int geonameId, java.lang.String language, Style style) throws java.lang.Exception
geonameId
- language
- style
- java.lang.Exception
public static java.util.List<Toponym> hierarchy(int geonameId, java.lang.String language, Style style) throws java.lang.Exception
geonameId
- language
- style
- java.lang.Exception
public static void saveTags(java.lang.String[] tags, Toponym toponym, java.lang.String username, java.lang.String password) throws java.lang.Exception
java.lang.Exception
public static java.util.List<WikipediaArticle> wikipediaSearch(java.lang.String q, java.lang.String language) throws java.lang.Exception
q
- language
- java.lang.Exception
public static java.util.List<WikipediaArticle> wikipediaSearchForTitle(java.lang.String title, java.lang.String language) throws java.lang.Exception
title
- language
- java.lang.Exception
public static java.util.List<WikipediaArticle> findNearbyWikipedia(double latitude, double longitude, java.lang.String language) throws java.lang.Exception
java.lang.Exception
public static java.util.List<WikipediaArticle> findNearbyWikipedia(double latitude, double longitude, double radius, java.lang.String language, int maxRows) throws java.lang.Exception
java.lang.Exception
public static int gtopo30(double latitude, double longitude) throws java.io.IOException, GeoNamesException
latitude
- longitude
- java.io.IOException
GeoNamesException
public static int srtm3(double latitude, double longitude) throws java.io.IOException, GeoNamesException
latitude
- longitude
- java.io.IOException
GeoNamesException
public static int[] srtm3(double[] latitude, double[] longitude) throws java.io.IOException
java.io.IOException
public static int srtm1(double latitude, double longitude) throws java.io.IOException, GeoNamesException
java.io.IOException
GeoNamesException
public static int[] srtm1(double[] latitude, double[] longitude) throws java.io.IOException
java.io.IOException
public static int astergdem(double latitude, double longitude) throws java.io.IOException, GeoNamesException
java.io.IOException
GeoNamesException
public static int[] astergdem(double[] latitude, double[] longitude) throws java.io.IOException
java.io.IOException
public static java.lang.String countryCode(double latitude, double longitude) throws java.io.IOException, GeoNamesException
countryCode(double, double, double)
with radius=0.0latitude
- longitude
- java.io.IOException
GeoNamesException
public static java.lang.String countryCode(double latitude, double longitude, double radius) throws java.io.IOException, GeoNamesException
latitude
- longitude
- radius
- (optional)java.io.IOException
GeoNamesException
public static CountrySubdivision countrySubdivision(double latitude, double longitude, double radius, int level, java.lang.String lang) throws java.io.IOException, java.lang.Exception
latitude
- longitude
- radius
- (optional)level
- (optional)lang
- (optional)java.io.IOException
java.lang.Exception
public static Timezone timezone(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
latitude
- longitude
- java.io.IOException
java.lang.Exception
public static java.lang.String ocean(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static WeatherObservation findNearByWeather(double latitude, double longitude) throws java.io.IOException, java.lang.Exception
latitude
- longitude
- java.io.IOException
java.lang.Exception
public static WeatherObservation weatherIcao(java.lang.String icaoCode) throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public static java.lang.String getGeoNamesServer()
public static java.lang.String getGeoNamesServerFailover()
public static void setGeoNamesServer(java.lang.String pGeoNamesServer)
geoNamesServer
- the geonamesServer to setpublic static void setGeoNamesServerFailover(java.lang.String geoNamesServerFailover)
geoNamesServerFailover
- the geoNamesServerFailover to setpublic static java.net.Proxy getProxy()
public static void setProxy(java.net.Proxy proxy)
proxy
- the proxy to set
If you are behind a proxy and cannot change the java system
properties, you can use this method to set a proxy. You define
it like this:
java.net.SocketAddress sa = new java.net.InetSocketAddress("myproxyserver", 8080);
java.net.Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, sa);
public static java.lang.String getUserName()
public static void setUserName(java.lang.String userName)
userName
- the userName to setpublic static java.lang.String getToken()
public static void setToken(java.lang.String token)
token
- the token to setpublic static Style getDefaultStyle()
public static void setDefaultStyle(Style defaultStyle)
defaultStyle
- the defaultStyle to setpublic static int getReadTimeOut()
public static void setReadTimeOut(int readTimeOut)
readTimeOut
- the readTimeOut to setpublic static int getConnectTimeOut()
public static void setConnectTimeOut(int connectTimeOut)
connectTimeOut
- the connectTimeOut to set