generalization.n100.building package
Submodules
generalization.n100.building.building_main module
generalization.n100.building.calculate_point_values module
- generalization.n100.building.calculate_point_values.main()[source]
- What:
Adds required fields for building point for symbology and resolves building conflicts: angle, hierarchy, and invisibility.
- How:
- reclassifying_hospital_and_church_points_from_matrikkel:
Reclassifies hospitals and churches in the matrikkel dataset to a new NBR value (“Other buildings” / “Andre bygg”).
- adding_original_source_to_points:
Adds a field to point features to indicate their original source: 0 for points from merged sources and 1 for points resulting from building polygons.
- merge_matrikkel_n50_touristcabins_with_points_from_grunnriss:
Merges points from the matrikkel_n50_touristcabins dataset with points created from building polygons. Adds a field to the merged points to determine and assign a symbol value based on their NBR code.
- find_undefined_nbr_values:
Selects building points with an undefined NBR value (symbol value of -99) from the dataset, and logs it. Then reclassify their NBR values and symbol_val values.
- calculate_angle_and_visibility:
Adds angle and visibility fields, and sets their value to 0
- calculate_hierarchy:
Calculates the hierarchy field based on symbol_val values
- Why:
A lot of field values is required in future processing, this makes sure that all fields are added and populated with the required values.
- generalization.n100.building.calculate_point_values.reclassifying_hospital_and_church_points_from_matrikkel()[source]
Reclassifies hospitals and churches in the matrikkel dataset to a new NBR value (“Other buildings” / “Andre bygg”).
- generalization.n100.building.calculate_point_values.adding_original_source_to_points()[source]
Adds a field to point features to indicate their original source: 0 for points from merged sources and 1 for points resulting from building polygons.
- generalization.n100.building.calculate_point_values.merge_matrikkel_n50_touristcabins_with_points_from_grunnriss()[source]
Merges points from the matrikkel_n50_touristcabins dataset with points created from building polygons. Adds a field to the merged points to determine and assign a symbol value based on their NBR code.
- generalization.n100.building.calculate_point_values.find_undefined_nbr_values()[source]
Selects building points with an undefined NBR value (symbol value of -99) from the dataset, and logs it. Then reclassify their NBR values and symbol_val values.
generalization.n100.building.calculate_polygon_values module
- generalization.n100.building.calculate_polygon_values.main()[source]
- What:
Adds required fields for building point for symbology and resolves building conflicts: angle, hierarchy, and invisibility.
- How:
- adding_angle_hierarchy_invisibility_fields:
Adds angle, hierarchy and invisibility fields and set their corresponding values.
- adding_symbol_val:
Adds symbol_val and reclassify NBR values for undefined nbr values
- Why:
The angle, hierarchy and invisibility fields are used in future processing, such as polygon_processor and RBC.
generalization.n100.building.data_clean_up module
generalization.n100.building.data_preparation module
generalization.n100.building.finalizing_buildings module
- generalization.n100.building.finalizing_buildings.main()[source]
- What:
Separates building points and polygons into their respective features they are going to be delivered as.
- How:
- removing_points_in_and_close_to_urban_areas:
Makes sure there are no building points near urban areas, except for hospital, churches and tourist huts.
- selecting_all_tourist_cabins:
Selects tourist cabins from building points to be delivered as a separate feature.
- building_polygons_to_line:
Converts building polygons to lines, to creat omrisslinje feature.
- selecting_hospital_and_churches_for_pictogram_featureclass:
Selects building points categorized as hospitals or churches for inclusion in a pictogram feature.
- assigning_final_file_names:
Copies final feature classes to their respective output file locations in the “final_outputs.gdb”
- generalization.n100.building.finalizing_buildings.removing_points_in_and_close_to_urban_areas()[source]
Makes sure there are no building points near urban areas, except for hospital, churches and tourist huts.
- generalization.n100.building.finalizing_buildings.selecting_all_tourist_cabins()[source]
Selects tourist cabins from building points to be delivered as a separate feature.
- generalization.n100.building.finalizing_buildings.building_polygons_to_line()[source]
Converts building polygons to lines, to creat omrisslinje feature.
generalization.n100.building.hospital_church_clusters module
- generalization.n100.building.hospital_church_clusters.main()[source]
This script detects and reduces hospital and church clusters. As an example can a cluster of 5 close hospital points be reduced to only consist of 1 point.
- generalization.n100.building.hospital_church_clusters.selecting_all_other_points_that_are_not_hospital_and_church()[source]
This script selects all other points that are not classified as hospital, church and touristhuts.
- generalization.n100.building.hospital_church_clusters.hospital_church_selections()[source]
Selects hospitals and churches from the input point feature class, creating separate feature layers for each category. Hospitals are selected based on ‘byggtyp_nbr’ values 970 and 719. Churches are selected based on ‘byggtyp_nbr’ value 671.
- generalization.n100.building.hospital_church_clusters.find_clusters()[source]
- What:
Finds hospital and church clusters. A cluster is defined as two or more points that are closer together than 200 meters.
- How:
Clusters are found for both hospitals and churches using the ‘FindPointClusters’ tool. The CLUSTER_IDs are joined with the original hospital and church feature classes. Points belonging to a hospital or church cluster are selected as new layers. Points not belonging to a cluster are selected as new layers. The tool FindPointClusters has a search distance of ‘200 Meters’ and a minimum of ‘2 Points’.
- Why?
Clusters amongst hospital and churches are found because it causes “noise” in the map. We do not want the map to display clusters of big symbols, this can make the map harder to read. Therefore, we want to identify clusters and reduce these.
- generalization.n100.building.hospital_church_clusters.reducing_clusters()[source]
- What:
Reduces hospital and church clusters by keeping only one point for each detected cluster. This ensures that spatial redundancy is minimized, and each cluster is represented by a single point, which is helpful for cleaner visualizations in the map.
- Why:
Clusters of hospitals or churches may result in overlapping or redundant data points, especially in dense areas. Reducing clusters by retaining only the most central point ensures the dataset remains representative without unnecessary duplication.
- How:
The function creates a minimum bounding polygon for each cluster of points, which is then converted into a center point. The nearest hospital or church point to the center point is identified and retained, while the remaining points in the cluster are discarded. Hospital and church points that are not part of a cluster are merged with the retained cluster points. The ‘RECTANGLE_BY_AREA’ option is used to create the minimum bounding geometry for each cluster. The nearest point to the center of the bounding polygon is identified using a ‘Near’ analysis, and a dictionary is used to store the minimum distance values for each cluster. If two points have the same distance to the center, one is selected randomly. Finally, the non-clustered points are merged with the selected points from clusters, resulting in a merged feature class with reduced hospital and church points.
- generalization.n100.building.hospital_church_clusters.hospitals_and_churches_too_close()[source]
This function identifies and filters out church points that are located too close to hospital points (within 215 meters). Only churches that are farther than 215 meters from hospitals are retained, while the rest are excluded from the final dataset. The result is a reduced and cleaner spatial dataset of hospitals and churches.
generalization.n100.building.point_displacement_with_buffer module
generalization.n100.building.point_propogate_displacement module
- generalization.n100.building.point_propogate_displacement.main()[source]
Propagates displacement for building points to ensure their alignment with roads is adjusted after the road generalization process.
- generalization.n100.building.point_propogate_displacement.propagate_displacement_building_points()[source]
First copies the data to be able to compare the changes due to PropagateDisplacement modifies input. Then propagates displacement for building polygons to ensure their alignment with roads is adjusted after the road generalization process.
generalization.n100.building.point_resolve_building_conflicts module
generalization.n100.building.polygon_propogate_displacement module
- generalization.n100.building.polygon_propogate_displacement.main()[source]
Propagates displacement for building polygons to ensure their alignment with roads is adjusted after the road generalization process.
- generalization.n100.building.polygon_propogate_displacement.propagate_displacement_building_polygons()[source]
First selects displacement features within a specified distance (500 meters) from the building polygons, then propagates displacement for building polygons to ensure their alignment with roads is adjusted after the road generalization process.
generalization.n100.building.polygon_resolve_building_conflicts module
generalization.n100.building.polygon_to_point module
- generalization.n100.building.polygon_to_point.main()[source]
- What:
Merges all points originating from building polygons to a single point feature.
- How:
- building_polygons_to_points:
First does a spatial join on all collapsed points from simplify_polygons. Then merges all points from building polygons to a single point feature.
generalization.n100.building.removing_overlapping_polygons_and_points module
generalization.n100.building.removing_points_and_erasing_polygons_in_water_features module
generalization.n100.building.simplify_polygons module
- generalization.n100.building.simplify_polygons.main()[source]
- What:
Simplify building polygons to make them easier to read and fit around other features at a N100 map scale.
- How:
- aggregate_polygons:
Aggregates small gaps between building polygons of the same type and fills in holes within building polygons.
- simplify_buildings_1:
Simplifies building polygons to optimize for N100 using SimplifyBuilding. Building polygons that are under the minimum area value will be transformed to points.
- simplify_polygons:
Simplifies building polygons to optimize for N100 using SimplifyPolygon. Building polygons that are under the minimum area value will be transformed to points.
- simplify_buildings_2:
Simplifies building polygons to optimize for N100 using SimplifyBuilding. Building polygons that are under the minimum area value will be transformed to points. Does the simplify in multiple steps to get better results.
- spatial_join_polygons:
Performs spatial join between simplified building polygons and original building polygons. Adds specific fields and assigns values to the building polygons, which will be useful for later in Resolve Building Conflict
- Why:
Makes the building polygons easier to read at a N100 map scale, and potentially easier to move compared to other features.
- generalization.n100.building.simplify_polygons.aggregate_polygons()[source]
Aggregates small gaps between building polygons of the same type and fills in holes within building polygons.
- generalization.n100.building.simplify_polygons.simplify_buildings_1()[source]
Simplifies building polygons to optimize for N100 using SimplifyBuilding. Building polygons that are under the minimum area value will be transformed to points.
- generalization.n100.building.simplify_polygons.simplify_polygons()[source]
Simplifies building polygons to optimize for N100 using SimplifyPolygon. Building polygons that are under the minimum area value will be transformed to points.