diff --git a/u4py/analysis/classify.py b/u4py/analysis/classify.py index 56b88308547192d9b8011331827ac7422629eb10..6ac75bf0c003b86785349ed7a3167613d179b479 100644 --- a/u4py/analysis/classify.py +++ b/u4py/analysis/classify.py @@ -150,7 +150,12 @@ def classify_shape( res.update(railways(res, sub_set_hull, osm_path, shp_cfg)) # Buildings - res.update(buildings(res, sub_set_hull, shp_cfg, osm_path)) + if use_online: + res.update( + buildings(res, sub_set_hull, shp_cfg, out_folder=cache_path) + ) + else: + res.update(buildings(res, sub_set_hull, shp_cfg, osm_path)) # Water res.update(rivers_water(res, sub_set_hull, osm_path, shp_cfg)) @@ -548,21 +553,42 @@ def buildings( else: logging.info("Loading building data from HLNUG server") building_data = u4web.query_hlnug( - "geologie/gk25/MapServer", - "Geologie (Kartiereinheiten)", + "geobasis/alkis_grenzen/MapServer", + "GEBAEUDE", region=sub_set_hull, out_folder=out_folder, suffix=f"{res['group']:05}", ) if building_data.empty: - logging.debug("Retrying to get geological data.") + logging.debug("Retrying to get building data.") building_data = u4web.query_hlnug( - "geologie/gk25/MapServer", - "Geologie (Kartiereinheiten)", + "geobasis/alkis_grenzen/MapServer", + "GEBAEUDE", region=sub_set_hull, out_folder=out_folder, suffix=f"{res['group']:05}", ) + if not building_data.empty: + res["buildings"] = building_data + + building_data_close = u4web.query_hlnug( + "geobasis/alkis_grenzen/MapServer", + "GEBAEUDE", + region=sub_set_hull, + out_folder=out_folder, + suffix=f"{res['group']:05}_close_", + ) + if building_data_close.empty: + logging.debug("Retrying to get building data.") + building_data_close = u4web.query_hlnug( + "geobasis/alkis_grenzen/MapServer", + "GEBAEUDE", + region=sub_set_hull, + out_folder=out_folder, + suffix=f"{res['group']:05}_close_", + ) + if not building_data_close.empty: + res["buildings_close"] = True if len(res["buildings"]) > 0: res["buildings_area"] = round(res["buildings"].area.sum(), 1) diff --git a/u4py/analysis/spatial.py b/u4py/analysis/spatial.py index 45006cb112f32f07197e4e7f789095f105d06307..c1f67fe67524f4af01734934a45427622981c7e0 100644 --- a/u4py/analysis/spatial.py +++ b/u4py/analysis/spatial.py @@ -106,7 +106,7 @@ def _get_coords(in_path: os.PathLike | list) -> list: """ coords = None - if isinstance(in_path, list): + if isinstance(in_path, list) and len(in_path) > 0: if isinstance(in_path[0], str): coords, source_index = _file_list_to_coords(in_path) elif isinstance(in_path[0], tuple): diff --git a/u4py/io/docx_report.py b/u4py/io/docx_report.py index ad1a17746181c0b2162316e0f979d2874b751834..b995041134d3a22e7ca4ac56488b77624a107425 100644 --- a/u4py/io/docx_report.py +++ b/u4py/io/docx_report.py @@ -241,7 +241,7 @@ def hlnug_description( # Add buildings if row["buildings_num"] > 0: - prgph.add_run("Auf der Rutschung ist Bebauung vorhanden. ") + prgph.add_run("Auf der Fläche der Rutschung ist Bebauung vorhanden. ") elif row["buildings_close"]: prgph.add_run( "In in maximal 50\u00a0m Entfernung vom Rand der Rutschung ist " diff --git a/u4py/scripts/gis_workflows/PostProcess_ClassifiedShapes.py b/u4py/scripts/gis_workflows/PostProcess_ClassifiedShapes.py index 994ee8a5ba76b944506e1d6f5d7332e4a3cebc28..adbea6277a043cd4f87859353d346fc42eb40910 100644 --- a/u4py/scripts/gis_workflows/PostProcess_ClassifiedShapes.py +++ b/u4py/scripts/gis_workflows/PostProcess_ClassifiedShapes.py @@ -340,7 +340,7 @@ def map_worker( crs, output_path, "known_features", - project["paths"]["diff_plan_path"], + dem_path, contour_path, plot_buffer=100, overwrite=overwrite_plots,