private void createObfFiles(File country, GroupFiles g) throws Exception { File obf = g.getObfFileName(country); if (!obf.exists() || g.getTimestamp() - obf.lastModified() > 1000) { if (obf.exists()) { log.info( "The file " + obf.getName() + " was updated for " + (g.getTimestamp() - obf.lastModified()) / 1000 + " seconds"); } else { log.info("The file " + obf.getName() + " doesn't exist"); } RTree.clearCache(); IndexCreator ic = new IndexCreator(country); ic.setIndexAddress(false); ic.setIndexPOI(true); ic.setIndexRouting(true); ic.setIndexMap(true); ic.setGenerateLowLevelIndexes(false); ic.setDialects(DBDialect.SQLITE_IN_MEMORY, DBDialect.SQLITE_IN_MEMORY); ic.setLastModifiedDate(g.getTimestamp()); File tmpFile = new File(g.dayName + ".tmp.odb"); tmpFile.delete(); ic.setRegionName(Algorithms.capitalizeFirstLetterAndLowercase(g.dayName)); ic.setNodesDBFile(tmpFile); log.info("Processing " + g.dayName + " " + g.osmGzFiles.size() + " files"); ic.generateIndexes( g.getSortedFiles(), new ConsoleProgressImplementation(), null, MapZooms.parseZooms("13-14;15-"), new MapRenderingTypesEncoder(country.getName()), log, false); File targetFile = new File(country, ic.getMapFileName()); targetFile.setLastModified(g.getTimestamp()); FileInputStream fis = new FileInputStream(targetFile); GZIPOutputStream gzout = new GZIPOutputStream(new FileOutputStream(obf)); Algorithms.streamCopy(fis, gzout); fis.close(); gzout.close(); obf.setLastModified(g.getTimestamp()); targetFile.delete(); } }