Skip to content

Commit

Permalink
Merge pull request #95 from kartverket/maris_local_git_branch
Browse files Browse the repository at this point in the history
Maris local git branch
  • Loading branch information
maribhe authored Feb 28, 2024
2 parents 88a8a38 + fbd3e0b commit 8cd98c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
7 changes: 0 additions & 7 deletions file_manager/n100/file_manager_buildings.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ class Building_N100(Enum):
reflecting the specific needs and naming conventions of river data management within the project.
"""

displacement_feature_asker__displacement_feature_asker__n100 = (
file_manager.generate_file_name_gdb(
script_source_name=displacement_feature_asker,
description="displacement_feature_asker",
)
)

#################################################
########### BUILDING DATA PREPARATION ###########
#################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def propagate_displacement_building_polygons():
such as roads or other structures.
"""

print(
"Before executing this function, ensure to switch to the new displacement feature"
)
print("MAKE SURE TO SWITCH TO NEW DISPLACEMENT FEATURE (AFTER ROAD GENERALIZATION")

print("Propogate displacement ...")
# Copying layer so no changes are made to the original
Expand Down
35 changes: 25 additions & 10 deletions generalization/n100/building/calculating_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,33 @@ def table_management():
fields_to_add = [["angle", "LONG"], ["hierarchy", "LONG"], ["invisibility", "LONG"]]
fields_to_calculate = [["angle", "0"], ["hierarchy", "0"], ["invisibility", "0"]]

# Add fields
arcpy.management.AddFields(
in_table=Building_N100.table_management__bygningspunkt_pre_resolve_building_conflicts__n100.value,
field_description=fields_to_add,
# Feature class to check fields existence
point_feature_class = (
Building_N100.table_management__bygningspunkt_pre_resolve_building_conflicts__n100.value
)

# Calculate fields
arcpy.management.CalculateFields(
in_table=Building_N100.table_management__bygningspunkt_pre_resolve_building_conflicts__n100.value,
expression_type="PYTHON3",
fields=fields_to_calculate,
)
# Check if fields already exist
existing_fields = arcpy.ListFields(point_feature_class)
existing_field_names = [field.name.lower() for field in existing_fields]
fields_to_add_names = [field[0].lower() for field in fields_to_add]

if not all(
field_name in existing_field_names for field_name in fields_to_add_names
):
# Add fields
arcpy.management.AddFields(
in_table=point_feature_class,
field_description=fields_to_add,
)

# Calculate fields
arcpy.management.CalculateFields(
in_table=point_feature_class,
expression_type="PYTHON3",
fields=fields_to_calculate,
)
else:
print("Fields already exist. Skipping adding and calculating fields.")

code_block_hierarchy = """def determineHierarchy(symbol_val):\n
if symbol_val in [1, 2, 3]:\n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ def main():
3. `joining_and_adding_fields`:
Reduces clusters to one point for each cluster.
"""
print(
"The Order here was removed it seems like, not sure which is the intended model. But needs to be looked at"
)
aggregate_polygons()
simplify_buildings_1()
simplify_polygons()
simplify_buildings_2()

join_and_add_fields()


Expand Down

0 comments on commit 8cd98c7

Please sign in to comment.