Package com.jbstrap.jbmap.geocoding
Class 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetEmail()
Gets the email address.int
getLimit()
Limits the number of search hits.int
getZoom()
Gets the current level of zoom.boolean
The reply contains address breakdown elements.boolean
Extra contentsboolean
Checks if alternative names are set.List<com.jbstrap.core.dao.Record>
reverseSearch
(double longitude, double latitude) In reverse search, you have to specify coordinates to receive an address.List<com.jbstrap.core.dao.Record>
Search abstract method.setAddressdetails
(boolean addressdetails) Include a breakdown of the address into elementsSets the email address.setExtratags
(boolean extratags) Should extra tags be includedsetLimit
(int limit) Limits the number of search hits.setNamedetails
(boolean namedetails) Checks if alternative names are set.setZoom
(int zoom) Set the zoom level in case of reverse search.Methods inherited from class com.jbstrap.jbmap.geocoding.GeoCodingBase
getBaseUrl, getParam, getPath, getTrustManager, prepareUrl, removeParam, runQuery, setParam, setPath, setTrustManager
-
Constructor Details
-
OSMGeoCoding
public OSMGeoCoding()Creates a OSMGeoCoding class instance.
-
-
Method Details
-
search
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 classGeoCodingBase<OSMGeoCoding>
- Parameters:
searchText
- Search address or place- Returns:
- Search results in a list of records
-
reverseSearch
In reverse search, you have to specify coordinates to receive an address.- Parameters:
longitude
- Longitudelatitude
- 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
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
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
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
Limits the number of search hits.- Parameters:
limit
- Limit the number of returned results. (Default: 10, Maximum: 50)- Returns:
- OSMGeoCoding instance
-
getEmail
Gets the email address.- Returns:
- Email address
-
setEmail
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
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
-