Package org.h2gis.functions.io.overpass
Class OverpassTool
- java.lang.Object
-
- org.h2gis.functions.io.overpass.OverpassTool
-
public class OverpassTool extends Object
Class to extract overpass data into a file- Author:
- E Bocher, CNRS
-
-
Constructor Summary
Constructors Constructor Description OverpassTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckOutputFile(String overpassQuery, File outputFile)Check if the file extension is supported and the same as specified in the queryInputStreamdownloadAsStream(String overpassQuery)Download the result of the query in a filevoiddownloadFile(String overpassQuery, String outputFile, boolean deleteFile)Download the result of the query into a fileStringgetEndpoint()Overpass endpointStringgetProxyHost()Get the proxy hostintgetProxyPort()Set a port to the proxyHttpURLConnectionprepareConnection(String overpassQuery)Prepare the connection to the overpass endpointvoidsetEndPoint(String endPoint)Set new endpointvoidsetProxyHost(String proxyHost)Set a new proxy hostvoidsetProxyPort(int proxyPort)Set a port to the proxy
-
-
-
Method Detail
-
prepareConnection
public HttpURLConnection prepareConnection(String overpassQuery) throws Exception
Prepare the connection to the overpass endpoint- Parameters:
overpassQuery- overpass query- Returns:
- HttpURLConnection
- Throws:
Exception
-
downloadAsStream
public InputStream downloadAsStream(String overpassQuery) throws Exception
Download the result of the query in a file- Parameters:
overpassQuery- the overpass QL- Returns:
- a stream connection
- Throws:
Exception- if the server cannot execute the query
-
downloadFile
public void downloadFile(String overpassQuery, String outputFile, boolean deleteFile) throws Exception
Download the result of the query into a file- Parameters:
overpassQuery- overpass QLoutputFile- the path of the file to save the datadeleteFile- true to delete the file if exists- Throws:
Exception- if the server cannot execute the query
-
checkOutputFile
public void checkOutputFile(String overpassQuery, File outputFile)
Check if the file extension is supported and the same as specified in the query- Parameters:
overpassQuery- queryoutputFile- output file
-
getEndpoint
public String getEndpoint()
Overpass endpoint- Returns:
- endpoint
-
setEndPoint
public void setEndPoint(String endPoint)
Set new endpoint- Parameters:
endPoint- endpoint
-
getProxyPort
public int getProxyPort()
Set a port to the proxy- Returns:
- the proxy value
-
setProxyPort
public void setProxyPort(int proxyPort)
Set a port to the proxy- Parameters:
proxyPort- proxy port value
-
getProxyHost
public String getProxyHost()
Get the proxy host- Returns:
- the proxy host
-
setProxyHost
public void setProxyHost(String proxyHost)
Set a new proxy host- Parameters:
proxyHost- proxy host value
-
-