Skip to content

Instantly share code, notes, and snippets.

@M-Bryant
Created November 7, 2013 03:26
Show Gist options
  • Save M-Bryant/7348476 to your computer and use it in GitHub Desktop.
Save M-Bryant/7348476 to your computer and use it in GitHub Desktop.
arcpy: Check whether specified layer has a selection
def hasSelection(lyr):
''' Check whether specified layer has a selection. '''
import arcpy
desc = arcpy.Describe(lyr)
if len(desc.FIDSet) == 0:
# Layer has no selection
return False
else:
# Layer has a selection
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment