Class OverpassTool


  • public class OverpassTool
    extends Object
    Class to extract overpass data into a file
    Author:
    E Bocher, CNRS
    • 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