Package gov.usgs.earthquake.geoserve
Class GeoservePlacesService
- java.lang.Object
-
- gov.usgs.earthquake.geoserve.GeoservePlacesService
-
public class GeoservePlacesService extends java.lang.Object
Access places from the Geoserve Places service.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONNECT_TIMEOUT
Default connection timeoutstatic java.lang.String
DEFAULT_ENDPOINT_URL
Default URL for GeoServe Places service.static int
DEFAULT_READ_TIMEOUT
Default read timeout
-
Constructor Summary
Constructors Constructor Description GeoservePlacesService()
Default constructorGeoservePlacesService(int connectTimeout, int readTimeout)
Constructor taking in timeouts and using default endpoint URLGeoservePlacesService(java.lang.String endpointUrl)
Constructor taking in endpointURLGeoservePlacesService(java.lang.String endpointUrl, int connectTimeout, int readTimeout)
Custom constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getConnectTimeout()
java.lang.String
getEndpointURL()
javax.json.JsonObject
getEventPlaces(java.math.BigDecimal latitude, java.math.BigDecimal longitude)
Find an event in the Places service via a latitude and longitudejavax.json.JsonObject
getNearestPlace(java.math.BigDecimal latitude, java.math.BigDecimal longitude)
Deprecated.javax.json.JsonObject
getNearestPlace(java.math.BigDecimal latitude, java.math.BigDecimal longitude, int maxradiuskm)
Get nearest place to a latitude and longitudeint
getReadTimeout()
void
setConnectTimeout(int connectTimeout)
void
setEndpointURL(java.lang.String endpointUrl)
void
setReadTimeout(int readTimeout)
-
-
-
Field Detail
-
DEFAULT_ENDPOINT_URL
public static final java.lang.String DEFAULT_ENDPOINT_URL
Default URL for GeoServe Places service.- See Also:
- Constant Field Values
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUT
Default connection timeout- See Also:
- Constant Field Values
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
Default read timeout- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GeoservePlacesService
public GeoservePlacesService()
Default constructor
-
GeoservePlacesService
public GeoservePlacesService(java.lang.String endpointUrl)
Constructor taking in endpointURL- Parameters:
endpointUrl
- for places service
-
GeoservePlacesService
public GeoservePlacesService(int connectTimeout, int readTimeout)
Constructor taking in timeouts and using default endpoint URL- Parameters:
connectTimeout
- in msreadTimeout
- in ms
-
GeoservePlacesService
public GeoservePlacesService(java.lang.String endpointUrl, int connectTimeout, int readTimeout)
Custom constructor- Parameters:
endpointUrl
- for Places serviceconnectTimeout
- in msreadTimeout
- in ms
-
-
Method Detail
-
getConnectTimeout
public int getConnectTimeout()
- Returns:
- connectTimemout
-
getEndpointURL
public java.lang.String getEndpointURL()
- Returns:
- endpointURL
-
getEventPlaces
public javax.json.JsonObject getEventPlaces(java.math.BigDecimal latitude, java.math.BigDecimal longitude) throws java.io.IOException, java.net.MalformedURLException
Find an event in the Places service via a latitude and longitude- Parameters:
latitude
- of eventlongitude
- of event- Returns:
- JSONObject of event
- Throws:
java.io.IOException
- on IO errorjava.net.MalformedURLException
- or URL error
-
getNearestPlace
public javax.json.JsonObject getNearestPlace(java.math.BigDecimal latitude, java.math.BigDecimal longitude) throws java.lang.IndexOutOfBoundsException, java.io.IOException, java.net.MalformedURLException
Deprecated.Get nearest place to a latitude and longitude- Parameters:
latitude
- of placelongitude
- of place- Returns:
- JSONObject of place
- Throws:
java.lang.IndexOutOfBoundsException
- on no places returnedjava.io.IOException
- on IO errorjava.net.MalformedURLException
- on URL error
-
getNearestPlace
public javax.json.JsonObject getNearestPlace(java.math.BigDecimal latitude, java.math.BigDecimal longitude, int maxradiuskm) throws java.io.IOException, java.net.MalformedURLException
Get nearest place to a latitude and longitude- Parameters:
latitude
- of placelongitude
- of placemaxradiuskm
- around place- Returns:
- JSONObject of place
- Throws:
java.io.IOException
- on IO errorjava.net.MalformedURLException
- on URL error
-
getReadTimeout
public int getReadTimeout()
- Returns:
- readTimeout
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
- Parameters:
connectTimeout
- int to set
-
setEndpointURL
public void setEndpointURL(java.lang.String endpointUrl)
- Parameters:
endpointUrl
- string to set
-
setReadTimeout
public void setReadTimeout(int readTimeout)
- Parameters:
readTimeout
- int to set
-
-