Monday 20 November 2017

count - Using if statement with ArcPy and GetCount?


I am looking to get a count on the polygonNieghbor and if it has polygons in it then I want to move to the next step MakeFeatureLayer. and If it doesn't have any features I would like it to finish.


Is there any other way to do this?


arcpy.GetCount_management(PolygonNeighbor_TableSelect)
arcpy.AddMessage(arcpy.GetMessages())

if arcpy.GetCount_management(PolygonNeighbor_TableSelect) > 0:
arcpy.MakeFeatureLayer_management(MapUnitPolys, inFeatures_lyr)

else
print "done"


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...