Package org.openstreetmap.josm.io
Class NameFinder
- java.lang.Object
-
- org.openstreetmap.josm.io.NameFinder
-
public final class NameFinder extends java.lang.Object
Search for names and related items.- Since:
- 11002
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NameFinder.NameFinderResultParser
A very primitive parser for the name finder's output.static class
NameFinder.SearchResult
Data storage for search results.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NOMINATIM_URL
Nominatim default URL.static StringProperty
NOMINATIM_URL_PROP
Nominatim URL property.
-
Constructor Summary
Constructors Modifier Constructor Description private
NameFinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.URL
buildNominatimURL(java.lang.String searchExpression)
Builds the Nominatim URL for performing the given searchstatic java.net.URL
buildNominatimURL(java.lang.String searchExpression, java.util.Collection<NameFinder.SearchResult> excludeResults)
Builds the Nominatim URL for performing the given search and excluding the results (of a previous search)static java.util.List<NameFinder.SearchResult>
parseSearchResults(java.io.Reader reader)
Parse search results as returned by Nominatim.static java.util.List<NameFinder.SearchResult>
query(java.net.URL url)
Performs a custom search.static java.util.List<NameFinder.SearchResult>
queryNominatim(java.lang.String searchExpression)
Performs a Nominatim search.
-
-
-
Field Detail
-
NOMINATIM_URL
public static final java.lang.String NOMINATIM_URL
Nominatim default URL.- See Also:
- Constant Field Values
-
NOMINATIM_URL_PROP
public static final StringProperty NOMINATIM_URL_PROP
Nominatim URL property.- Since:
- 12557
-
-
Constructor Detail
-
NameFinder
private NameFinder()
-
-
Method Detail
-
buildNominatimURL
public static java.net.URL buildNominatimURL(java.lang.String searchExpression)
Builds the Nominatim URL for performing the given search- Parameters:
searchExpression
- the Nominatim query- Returns:
- the Nominatim URL
-
buildNominatimURL
public static java.net.URL buildNominatimURL(java.lang.String searchExpression, java.util.Collection<NameFinder.SearchResult> excludeResults)
Builds the Nominatim URL for performing the given search and excluding the results (of a previous search)- Parameters:
searchExpression
- the Nominatim queryexcludeResults
- the results to exclude- Returns:
- the Nominatim URL
- See Also:
- Result limitation in Nominatim Documentation
-
queryNominatim
public static java.util.List<NameFinder.SearchResult> queryNominatim(java.lang.String searchExpression) throws java.io.IOException
Performs a Nominatim search.- Parameters:
searchExpression
- Nominatim search expression- Returns:
- search results
- Throws:
java.io.IOException
- if any IO error occurs.
-
query
public static java.util.List<NameFinder.SearchResult> query(java.net.URL url) throws java.io.IOException
Performs a custom search.- Parameters:
url
- search URL to any Nominatim instance- Returns:
- search results
- Throws:
java.io.IOException
- if any IO error occurs.
-
parseSearchResults
public static java.util.List<NameFinder.SearchResult> parseSearchResults(java.io.Reader reader) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
Parse search results as returned by Nominatim.- Parameters:
reader
- reader- Returns:
- search results
- Throws:
javax.xml.parsers.ParserConfigurationException
- if a parser cannot be created which satisfies the requested configuration.org.xml.sax.SAXException
- for SAX errors.java.io.IOException
- if any IO error occurs.
-
-