Commit fa2435d1 authored by Eric Duminil's avatar Eric Duminil
Browse files

Allow to specify where cache is written, or gml files are written

parent 4e7e3e72
......@@ -90,6 +90,12 @@ public class GreenEnricher implements Runnable
@Option(names = { "-w", "--wkt" }, description = "Optional WKT polygon to cut the region after processing.")
private String wkt;
@Option(names = { "--output" }, description = "Optional location for output folder", defaultValue = "data/")
private Path outputFolder;
@Option(names = { "--cache" }, description = "Optional location for cache folder", defaultValue = "data/cache")
private Path cacheFolder;
public static void main(String[] args) {
new CommandLine(new GreenEnricher()).execute(args);
......@@ -167,7 +173,7 @@ public class GreenEnricher implements Runnable
OsmData osmData = new OsmData();
String boundingBoxString = GreenEnricher.extractAndConvertBoundingBox(cityModel, osmData);
String boundingBoxBasename = boundingBoxString.replace(",", "__").replace('.', '_');
Path osmCache = Paths.get("data", "cache", "osm_response_" + boundingBoxBasename + ".xml");
Path osmCache = cacheFolder.resolve("osm_response_" + boundingBoxBasename + ".xml");
if (!Files.exists(osmCache)) {
System.out.println("Downloading OSM data for " + boundingBoxString);
HttpResponse<String> response = GreenEnricher.getOsmData(boundingBoxString);
......@@ -200,7 +206,7 @@ public class GreenEnricher implements Runnable
String inputString = citygmlInput.getFileName().toString();
String inputPathWithoutFileEnding = inputString.substring(0, inputString.lastIndexOf('.'));
Path outputPath = Paths.get("data", inputPathWithoutFileEnding + "_" + outputSuffix + ".gml");
Path outputPath = outputFolder.resolve(inputPathWithoutFileEnding + "_" + outputSuffix + ".gml");
System.out.println("Writing output file to " + outputPath);
writeCityGML(cityModel, outputPath);
System.out.println("Done");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment