1

I have a feature class with sub-types that need to be modified and re-ordered as new data becomes available. Right now I have 20 subtypes but could potentially have close to a 100. I use the subtypes numbers for labeling so the subtypes and the subtypes need to be in a logical order, grouped by similar items.

Having to insert a new item in position 3 for example, requires me to rebuild the entire list from position 3 on; adding a new item in position for and bumping up the remaining 17 items.
http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/an-overview-of-the-subtypes-toolset.htm This will get really cumbersome really fast. (This features class is exported to a feature service and accessed by many users on our web GIS.) I don't see a way to add then re-order subtypes without having to rewrite them all, or insert a new subtype at a specific position, or export subtypes to a file, modify this list externally (notepad) then import subtypes.

Is there a workaround or some other method I am not seeing that would make it easier to change the order of subtypes?

enter image description here

1
  • Subtypes are numerical coded values - in the database it stores the 1, 2, 3 etc. for those values. If you change a subtype, or insert a new one (and move the other values down) any existing features will keep their existing value, and whatever new Description for that existing value.
    – Midavalo
    Commented Jan 9, 2017 at 16:59

1 Answer 1

1

Here is my workaround solution; I modified a standalone Python script i found in ArcGIS 10.4.1 help (Tool Help for the Add Subtype tool) I can easily change and modify the list of subtypes in the script, then run it and it removes the existing subtypes sets up new subtypes and sets the default.

# Name: ManageSubtypes.py
# Purpose: Create a subtype definition
# Author: ESRI

# Import system modules
import arcpy

try:

    # Set local parameters
    inFeatures = arcpy.GetParameterAsText(0)

    # Process: Set Subtype Field...
    arcpy.SetSubtypeField_management(inFeatures, arcpy.GetParameterAsText(1))

    # Process: Add Subtypes...
    # Store all the suptype values in a dictionary with the subtype code as the "key" and the 
    # subtype description as the "value" (stypeDict[code])
    stypeDict = {"0": "0: Unclassified",\
        "1": "1: High Voltage Cable",\
        "2": "2: High Voltage Cable (Approximate Location)",\
        "3": "3: Grounding",\
        "4": "4: Grounding (Approximate Location)",\
        "5": "5: Fiber Optic Cable",\
        "6": "6: Fiber Optic Cable (Approximate Location)",\
        "7": "7: Propane Line",\
        "8": "8: Fire Water Pipeline",\
        "9": "9: Fresh Water Pipeline",\
        "10": "10: Well Water Pipeline",\
        "11": "11: Potable Water Pipeline",\
        "12": "12: HDPE Pipe",\
        "13": "13: Sanitary Effluent Pipeline",\
        "14": "14: Sanitary Gravity Pipeline",\
        "15": "15: Sanitary Pipeline",\
        "16": "16: MRP 20” Pipeline",\
        "17": "17: North Pond Pipeline",\
        "18": "18: South Pond Pipeline",\
        "19": "19: Tailings Pipeline",\
        "20": "20: Reclaim Pipeline",\
        "21": "21: Reclaim & Tailings Pipeline",\
        "22": "22: Weeping Tile",\
        "23": "23: Assay Lab Piping",
        "24": "24: Pinewood River Pipeline",\
        "25": "25: Western Corridor 6” Pipeline "}


    # use a for loop to cycle through the dictionary
    for code in stypeDict:
        arcpy.AddSubtype_management(inFeatures, code, stypeDict[code])     

    # Process: Set Default Subtype...
    arcpy.SetDefaultSubtype_management(inFeatures, "0")

except Exception as err:
    print(err.args[0])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.