for i in range(0,800): arcpy.MakeRasterLayer_management(Mask_Rst,"MaskRst_lyr","Rowid = "+ str(i)) outExtractByMask = ExtractByMask(InRst,"MaskRst_lyr") outExtractByMask.save(OutDir + "\\rst" + str(i))
Could you use ExtractByAttributes(in_raster, where_clause) instead of SelectLayerByAttribute_management(in_layer_or_view, {selection_type}, {where_clause})?
I want to replicate something that I can do within ArcMap and model builder. I have a categorical raster with an attribute table consisting of 10 fields "Rowid", "Value", and "Count". I would like to use the SelectLayerByAttribute_Management tool using arcpy. My code so far is:# Import arcpy moduleimport arcpy# define the location of raster titled rstName Rst = "C:/..../rstName"# Select Rowid = 0arcpy.SelectLayerByAttribute_management(Rst, "NEW_SELECTION", "\"Rowid\" = 0")The error msg I get is:* File "C:\...\abc.py", line 16, in <module>*** arcpy.SelectLayerByAttribute_management(Rst, "NEW_SELECTION", "\"Rowid\" = 0")* File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 4259, in SelectLayerByAttribute*** raise eExecuteError: Failed to execute. Parameters are not valid.ERROR 000840: The value is not a Table View.ERROR 000825: The value is not a layer or table viewERROR 000840: The value is not a Mosaic Layer.Failed to execute (SelectLayerByAttribute).-------------------------Can some help me troubleshoot this issue?
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.