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
`OverpassTool()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `checkOutputFile​(String overpassQuery, File outputFile)` Check if the file extension is supported and the same as specified in the query
`InputStream` `downloadAsStream​(String overpassQuery)` Download the result of the query in a file
`void` `downloadFile​(String overpassQuery, String outputFile, boolean deleteFile)` Download the result of the query into a file
`String` `getEndpoint()` Overpass endpoint
`String` `getProxyHost()` Get the proxy host
`int` `getProxyPort()` Set a port to the proxy
`HttpURLConnection` `prepareConnection​(String overpassQuery)` Prepare the connection to the overpass endpoint
`void` `setEndPoint​(String endPoint)` Set new endpoint
`void` `setProxyHost​(String proxyHost)` Set a new proxy host
`void` `setProxyPort​(int proxyPort)` Set a port to the proxy

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### OverpassTool

    public OverpassTool()

### 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 QL
  `outputFile` - the path of the file to save the data
  `deleteFile` - 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` - query
  `outputFile` - 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