path is workspace
# extract features by attrtibute # import system modules import arcpy # get user supplied path, layers and fields path = arcpy.GetParameterAsText(0) arcpy.env.workspace = path # riverLayer is Rio_Panuco_Lyr Feature Layer inputLayer = arcpy.GetParameterAsText(1) # confluence is river type 'link' and is a string confluence = arcpy.GetParameterAsText(2) whereClause = "{0} = '{1}'".format(arcpy.AddFieldDelimiters(inputLayer, typeField), confluence) # typeField is fieldname 'type' and is SQL expression typeField = arcpy.GetParameterAsText(3) # set output location outputLayer = arcpy.GetParameterAsText(4) # error trapping measures try: arcpy.Select_analysis(inputLayer, outputLayer, whereClause) except: print arcpy.GetMessages()
whereClause = "{0} = '{1}'".format(arcpy.AddFieldDelimiters(inputLayer, typeField), confluence)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.