public static void downloadData(Connection con,Geometry area, String fileName, boolean deleteFile) throws FileNotFoundException, IOException, SQLException, CoordinateOperationException {
        File file = URIUtilities.fileFromString(fileName);
        if (file.exists()) {
            if(deleteFile){
              file.delete();
            }
            else{
            throw new FileNotFoundException("The following file already exists:\n" + fileName);
            }
        }
        if (file.getName().toLowerCase().endsWith(".osm")) {
            if (area != null) {
                int srid = area.getSRID();
                if (srid!=0) {
                    downloadOSMFile(file, ST_Transform.ST_Transform(con, area, 4326).getEnvelopeInternal());
                } else {
                    downloadOSMFile(file, area.getEnvelopeInternal());
                }
            }
        } else {
            throw new SQLException("Supported format is .osm");
        }
    }
public static void downloadData ( Connection con , Geometry area , String fileName , boolean deleteFile ) throws FileNotFoundException , IOException , SQLException , CoordinateOperationException { File file = URIUtilities . fileFromString ( fileName ) ; if ( file . exists ( ) ) { if ( deleteFile ) { file . delete ( ) ; } else { throw new FileNotFoundException ( "The following file already exists:\n" + fileName ) ; } } if ( file . getName ( ) . toLowerCase ( ) . endsWith ( ".osm" ) ) { if ( area != null ) { int srid = area . getSRID ( ) ; if ( srid != 0 ) { downloadOSMFile ( file , ST_Transform . ST_Transform ( con , area , 4326 ) . getEnvelopeInternal ( ) ) ; } else { downloadOSMFile ( file , area . getEnvelopeInternal ( ) ) ; } } } else { throw new SQLException ( "Supported format is .osm" ) ; } }
@param con the database connection
@param area The geometry used to compute the area set to the OSM server
@param fileName The path to save the osm file
@param deleteFile True to delete the file if exists
@throws FileNotFoundException
@throws IOException
@throws java.sql.SQLException
@throws org.cts.op.CoordinateOperationException