Class OSMGeoCoding


public class OSMGeoCoding extends GeoCodingBase<OSMGeoCoding>

In the GeoCoding process, a text description of a place (an address or a place name) returns the geographical coordinates of the place. Reverse GeoCoding means that geographical coordinates return the descrption of a place.

GeoCodingot is ensured by a service provider. This class uses the OpenStreetMap Nominatim GeoCoding service provider.

Since:
4.0
See Also:
  • Constructor Details

    • OSMGeoCoding

      public OSMGeoCoding()
      Creates a OSMGeoCoding class instance.
  • Method Details

    • search

      public List<com.jbstrap.core.dao.Record> search(String searchText)
      Description copied from class: GeoCodingBase
      Search abstract method. Required to implement. Use the setParam() method to set the text and the runQuery() method to perform the query. The returned result is a list of records (you specify this to the method).
      Specified by:
      search in class GeoCodingBase<OSMGeoCoding>
      Parameters:
      searchText - Search address or place
      Returns:
      Search results in a list of records
    • reverseSearch

      public List<com.jbstrap.core.dao.Record> reverseSearch(double longitude, double latitude)
      In reverse search, you have to specify coordinates to receive an address.
      Parameters:
      longitude - Longitude
      latitude - Latitude
      Returns:
      Search results in a list of records
    • isAddressdetails

      public boolean isAddressdetails()
      The reply contains address breakdown elements.
      Returns:
      addressdetails The address is returned broken down into elements
    • setAddressdetails

      public OSMGeoCoding setAddressdetails(boolean addressdetails)
      Include a breakdown of the address into elements
      Parameters:
      addressdetails - Include a breakdown of the address into elements. (Default: false)
      Returns:
      OSMGeoCoding instance
    • isExtratags

      public boolean isExtratags()
      Extra contents
      Returns:
      Are extra contents set?
    • setExtratags

      public OSMGeoCoding setExtratags(boolean extratags)
      Should extra tags be included
      Parameters:
      extratags - Include additional information in the result if available, e.g. wikipedia link, opening hours. (Default: false)
      Returns:
      OSMGeoCoding instance
    • isNamedetails

      public boolean isNamedetails()
      Checks if alternative names are set.
      Returns:
      Are alternative names set?
    • setNamedetails

      public OSMGeoCoding setNamedetails(boolean namedetails)
      Checks if alternative names are set.
      Parameters:
      namedetails - Include a list of alternative names in the results. These may include language variants, references, operator and brand. (Default: false)
      Returns:
      OSMGeoCoding instance
    • getLimit

      public int getLimit()
      Limits the number of search hits.
      Returns:
      The number of returned search hits
    • setLimit

      public OSMGeoCoding setLimit(int limit)
      Limits the number of search hits.
      Parameters:
      limit - Limit the number of returned results. (Default: 10, Maximum: 50)
      Returns:
      OSMGeoCoding instance
    • getEmail

      public String getEmail()
      Gets the email address.
      Returns:
      Email address
    • setEmail

      public OSMGeoCoding setEmail(String email)
      Sets the email address.
      Parameters:
      email - If you are making large numbers of request please include an appropriate email address to identify your requests. See Nominatim's Usage Policy (https://operations.osmfoundation.org/policies/nominatim/) for more details.
      Returns:
      OSMGeoCoding instance
    • getZoom

      public int getZoom()
      Gets the current level of zoom.
      Returns:
      Zoom level. Default value: 18
    • setZoom

      public OSMGeoCoding setZoom(int zoom)
      Set the zoom level in case of reverse search. Level of detail required for the address. Default: 18. This is a number that corresponds roughly to the zoom level used in XYZ tile sources in frameworks like Leaflet.js, Openlayers etc. In terms of address details the zoom levels are as follows:

      ********************************

      zoom | address detail:
      • 3 | country
      • 5 | state
      • 8 | county
      • 10 | city
      • 14 | suburb
      • 16 | major streets
      • 17 | major and minor streets
      • 18 | building

      ********************************

      Parameters:
      zoom - Zoom level between 0 and 18
      Returns:
      OSMGeoCoding instance