diff --git a/download_files_from_LGL_BW.py b/download_files_from_LGL_BW.py index 3063ffc03c8f73a47d774a81eacf2d242478edab..d5f20f7324e6f149b7c75d76d34d1096e7a6bf3a 100644 --- a/download_files_from_LGL_BW.py +++ b/download_files_from_LGL_BW.py @@ -129,14 +129,27 @@ def extract_region(output_dir: Path, location_name: str, wkt: str) -> None: if len(gml_inputs) == 0: print("Error: No CityGML found. At least part of the region should be in Baden-Württemberg!") return + + params_path = output_dir / 'params.txt' + wkt_path = output_dir / 'region.wkt' + print(f" Extracting {output_file}.") + with open(wkt_path, 'w') as f: + f.write(wkt) + + with open(params_path, 'w') as f: + f.write("--input\n") + f.write(','.join(f"{gml}" for gml in gml_inputs)) + f.write("\n") + f.write("--output\n") + f.write(f'"{output_file}"\n') + f.write("--wkt\n") + f.write(f'"{wkt_path}"\n') + result = subprocess.run(['java', '-classpath', f'{region_chooser_libs}', 'eu.simstadt.regionchooser.RegionChooserCLI', - '--input', ','.join(str(gml) for gml in gml_inputs), - '--output', str(output_file), - '--wkt', '-', + f'@{params_path}' ], - input=wkt, text=True, capture_output=True, check=True