cityofaustin / atd-data-tech

Austin Transportation Data & Technology Services
17 stars 2 forks source link

Develop attribute rule for associating CTN segments with council districts #8696

Closed johnclary closed 2 years ago

johnclary commented 2 years ago

For reference, see these docs.

Also, this issue.

alan-deanda commented 2 years ago

Arcade field calculation:

if(IsEmpty($feature.COUNCIL_DISTRICT)) {
    return '10';
} else {
    return $feature.COUNCIL_DISTRICT + ', ' + '10';
}

Python script to select by location and adding to selection

# Define variables
STN_council_districts = "STN_council_districts"
Council_Districts_Fill = "Council Districts Fill"

    # Process: Select Layer By Location
STN_council_districts, Output_Layer_Names, Count = arcpy.management.SelectLayerByLocation(in_layer=[STN_council_districts], overlap_type="WITHIN", select_features=Council_Districts_Fill, search_distance="", selection_type="NEW_SELECTION", invert_spatial_relationship="NOT_INVERT")

    # Process: Select Layer By Location (2)
STN_council_districts, Output_Layer_Names, Count = arcpy.management.SelectLayerByLocation(in_layer=[STN_council_districts], overlap_type="BOUNDARY_TOUCHES", select_features=Council_Districts_Fill, search_distance="", selection_type="ADD_TO_SELECTION", invert_spatial_relationship="NOT_INVERT")

    # Process: Select Layer By Location (3)
STN_council_districts, Output_Layer_Names, Count = arcpy.management.SelectLayerByLocation(in_layer=[STN_council_districts], overlap_type="INTERSECT", select_features=Council_Districts_Fill, search_distance="", selection_type="ADD_TO_SELECTION", invert_spatial_relationship="NOT_INVERT")