I am trying to add a raster dataset to my dataframe from a path stored in a field within the attribute table of a feature class. Ideally, I would like to add the rasters one at a time based upon a selection performed on the feature class. I have a python script which will add the raster based on the file path in the field but I am having trouble adding the selection process to it. Has anybody done something similar or have any ideas?
Thanks in advance
import arcpy
fc = "C:/Users/username/Documents/ArcGIS/Default.gdb/script_input"
fields = ["filepath"]
# For each row print the "path" field
#
#
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
pathfield = ("{0}".format(row[0]))
print(pathfield)
# Local variables:
qqlayer = pathfield
Output_raster_layer_name = "Raster to Look at"
# Process: Make Raster Layer
test = arcpy.MakeRasterLayer_management(qqlayer, Output_raster_layer_name, "", "213322.051897854 4081064.77976305 290804.751897854 4174358.97976305", "")