Package gov.usgs.earthquake.geoserve
Class GeoservePlacesService
java.lang.Object
gov.usgs.earthquake.geoserve.GeoservePlacesService
Access places from the Geoserve Places service.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault connection timeoutstatic final StringDefault URL for GeoServe Places service.static final intDefault read timeout -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorGeoservePlacesService(int connectTimeout, int readTimeout) Constructor taking in timeouts and using default endpoint URLGeoservePlacesService(String endpointUrl) Constructor taking in endpointURLGeoservePlacesService(String endpointUrl, int connectTimeout, int readTimeout) Custom constructor -
Method Summary
Modifier and TypeMethodDescriptionintjavax.json.JsonObjectgetEventPlaces(BigDecimal latitude, BigDecimal longitude) Find an event in the Places service via a latitude and longitudejavax.json.JsonObjectgetNearestPlace(BigDecimal latitude, BigDecimal longitude) Deprecated.javax.json.JsonObjectgetNearestPlace(BigDecimal latitude, BigDecimal longitude, int maxradiuskm) Get nearest place to a latitude and longitudeintvoidsetConnectTimeout(int connectTimeout) voidsetEndpointURL(String endpointUrl) voidsetReadTimeout(int readTimeout)
-
Field Details
-
DEFAULT_ENDPOINT_URL
Default URL for GeoServe Places service.- See Also:
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUTDefault connection timeout- See Also:
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUTDefault read timeout- See Also:
-
-
Constructor Details
-
GeoservePlacesService
public GeoservePlacesService()Default constructor -
GeoservePlacesService
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
Custom constructor- Parameters:
endpointUrl- for Places serviceconnectTimeout- in msreadTimeout- in ms
-
-
Method Details
-
getConnectTimeout
public int getConnectTimeout()- Returns:
- connectTimemout
-
getEndpointURL
- Returns:
- endpointURL
-
getEventPlaces
public javax.json.JsonObject getEventPlaces(BigDecimal latitude, BigDecimal longitude) throws IOException, MalformedURLException Find an event in the Places service via a latitude and longitude- Parameters:
latitude- of eventlongitude- of event- Returns:
- JSONObject of event
- Throws:
IOException- on IO errorMalformedURLException- or URL error
-
getNearestPlace
@Deprecated public javax.json.JsonObject getNearestPlace(BigDecimal latitude, BigDecimal longitude) throws IndexOutOfBoundsException, IOException, MalformedURLException Deprecated.Get nearest place to a latitude and longitude- Parameters:
latitude- of placelongitude- of place- Returns:
- JSONObject of place
- Throws:
IndexOutOfBoundsException- on no places returnedIOException- on IO errorMalformedURLException- on URL error
-
getNearestPlace
public javax.json.JsonObject getNearestPlace(BigDecimal latitude, BigDecimal longitude, int maxradiuskm) throws IOException, MalformedURLException Get nearest place to a latitude and longitude- Parameters:
latitude- of placelongitude- of placemaxradiuskm- around place- Returns:
- JSONObject of place
- Throws:
IOException- on IO errorMalformedURLException- on URL error
-
getReadTimeout
public int getReadTimeout()- Returns:
- readTimeout
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) - Parameters:
connectTimeout- int to set
-
setEndpointURL
- Parameters:
endpointUrl- string to set
-
setReadTimeout
public void setReadTimeout(int readTimeout) - Parameters:
readTimeout- int to set
-