Class GeoservePlacesService

java.lang.Object
gov.usgs.earthquake.geoserve.GeoservePlacesService

public class GeoservePlacesService extends Object
Access places from the Geoserve Places service.
  • Field Details

    • DEFAULT_ENDPOINT_URL

      public static final String DEFAULT_ENDPOINT_URL
      Default URL for GeoServe Places service.
      See Also:
    • DEFAULT_CONNECT_TIMEOUT

      public static final int DEFAULT_CONNECT_TIMEOUT
      Default connection timeout
      See Also:
    • DEFAULT_READ_TIMEOUT

      public static final int DEFAULT_READ_TIMEOUT
      Default read timeout
      See Also:
  • Constructor Details

    • GeoservePlacesService

      public GeoservePlacesService()
      Default constructor
    • GeoservePlacesService

      public GeoservePlacesService(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 ms
      readTimeout - in ms
    • GeoservePlacesService

      public GeoservePlacesService(String endpointUrl, int connectTimeout, int readTimeout)
      Custom constructor
      Parameters:
      endpointUrl - for Places service
      connectTimeout - in ms
      readTimeout - in ms
  • Method Details

    • getConnectTimeout

      public int getConnectTimeout()
      Returns:
      connectTimemout
    • getEndpointURL

      public String 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 event
      longitude - of event
      Returns:
      JSONObject of event
      Throws:
      IOException - on IO error
      MalformedURLException - 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 place
      longitude - of place
      Returns:
      JSONObject of place
      Throws:
      IndexOutOfBoundsException - on no places returned
      IOException - on IO error
      MalformedURLException - 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 place
      longitude - of place
      maxradiuskm - around place
      Returns:
      JSONObject of place
      Throws:
      IOException - on IO error
      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(String endpointUrl)
      Parameters:
      endpointUrl - string to set
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Parameters:
      readTimeout - int to set