POST
|
This works just as you said, thank you so much for the quick reply. Regards.
... View more
06-27-2012
11:46 AM
|
0
|
0
|
329
|
POST
|
I'm somewhat of a novice at Python but I created a script that performs a series of selections on some layers and then performs a count on each selection and displays the count in message window. So far it's straight forward but I have two additionalcounts that require the summation of two other previous counts. How do I achieve this summation of counts? I've included my script below. The last two line of the code are the ones in question that need to be summed. Thank you for your help and advice, much appreciated. [PHP]import arcpy # Local variables: ProductionGIS_GISADM_NCS_CLEARANCE = "ProductionGIS.GISADM.NCS_CLEARANCE" ProductionGIS_GISADM_NCS_MILEPOST = "ProductionGIS.GISADM.NCS_MILEPOST" ProductionGIS_GISADM_NCS_EQUATIONS = "ProductionGIS.GISADM.NCS_EQUATIONS" ProductionGIS_GISADM_NCS_SIGN = "ProductionGIS.GISADM.NCS_SIGN" ProductionGIS_GISADM_NCS_SIGNAL = "ProductionGIS.GISADM.NCS_SIGNAL" ProductionGIS_GISADM_NCS_INTERLOCKING = "ProductionGIS.GISADM.NCS_INTERLOCKING" ProductionGIS_GISADM_NCS_SWITCH = "ProductionGIS.GISADM.NCS_SWITCH" ProductionGIS_GISADM_NCS_XING = "ProductionGIS.GISADM.NCS_XING" ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events = "ProductionGIS.GISADM.NCS_SUB_CODE_EVT Events" Output_Layer_Name = "ProductionGIS.GISADM.NCS_CLEARANCE" Output_Layer_Name__2_ = "ProductionGIS.GISADM.NCS_MILEPOST" Output_Layer_Name__3_ = "ProductionGIS.GISADM.NCS_EQUATIONS" Output_Layer_Name__4_ = "ProductionGIS.GISADM.NCS_SIGN" Output_Layer_Name__5_ = "ProductionGIS.GISADM.NCS_SIGNAL" Output_Layer_Name__6_ = "ProductionGIS.GISADM.NCS_INTERLOCKING" Output_Layer_Name__7_ = "ProductionGIS.GISADM.NCS_SWITCH" Output_Layer_Name__8_ = "ProductionGIS.GISADM.NCS_XING" # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_CLEARANCE, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (2) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_MILEPOST, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (3) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_EQUATIONS, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (4) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_SIGN, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (5) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_SIGNAL, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (6) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_INTERLOCKING, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (7) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_SWITCH, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") # Process: Select Layer By Location (8) arcpy.SelectLayerByLocation_management(ProductionGIS_GISADM_NCS_XING, "INTERSECT", ProductionGIS_GISADM_NCS_SUB_CODE_EVT_Events, "", "NEW_SELECTION") result1 = arcpy.GetCount_management(Output_Layer_Name) featurecount1 = int(result1.getOutput(0)) result2 = arcpy.GetCount_management(Output_Layer_Name__2_) featurecount2 = int(result2.getOutput(0)) result3 = arcpy.GetCount_management(Output_Layer_Name__3_) featurecount3 = int(result3.getOutput(0)) result4 = arcpy.GetCount_management(Output_Layer_Name__4_) featurecount4 = int(result4.getOutput(0)) result5 = arcpy.GetCount_management(Output_Layer_Name__5_) featurecount5 = int(result5.getOutput(0)) result6 = arcpy.GetCount_management(Output_Layer_Name__6_) featurecount6 = int(result6.getOutput(0)) result7 = arcpy.GetCount_management(Output_Layer_Name__7_) featurecount7 = int(result7.getOutput(0)) result8 = arcpy.GetCount_management(Output_Layer_Name__8_) featurecount8 = int(result8.getOutput(0)) arcpy.AddMessage("Clearance Point Count = " + str(featurecount1)) arcpy.AddMessage("Milepost Point Count = " + str(featurecount2)) arcpy.AddMessage("Equations Point Count = " + str(featurecount3)) arcpy.AddMessage("Sign Point Count = " + str(featurecount4)) arcpy.AddMessage("Signal Point Count = " + str(featurecount5)) arcpy.AddMessage("Interlocking Point Count = " + str(featurecount6)) arcpy.AddMessage("Switch Point Count = " + str(featurecount7)) arcpy.AddMessage("Xing Point Count = " + str(featurecount8)) arcpy.AddMessage("Nodes Point Count = " + str(featurecount3)+str(featurecount7)) arcpy.AddMessage("Milepost Helper Point Count = " + (str(featurecount3)+str(featurecount7)+str(featurecount5)+str(featurecount2)))[/PHP]
... View more
06-27-2012
11:14 AM
|
0
|
3
|
767
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|