AnsweredAssumed Answered

Export Raster with Applied Color Ramp with ArcPy

Question asked by sourav_164 on Jun 14, 2018
Latest reply on Jun 14, 2018 by sourav_164

There is an NDVI image of a small agricultural area. I was also given separate shapefiles for all fields (37 fields) inside that area. I have written a script that clipped NDVI image for each field using the shapefile. When a clipped NDVI image is saved, it is exported in tiff format and grayscale.

 

Shape_Files_Name = ['TX1_10_poly.shp', 'TX1_11N_poly.shp', 'TX1_11S_poly.shp'...........]
     for n in Shape_Files_Name:   
     #mask out each field   
     Clipped_File_Name = random.randint(1,101)   
      arcpy
.gp.ExtractByMask_sa (NDVI_Layer, n,
Clipped_File_Name )
     #save the raster
    arcpy.CopyRaster_management (Clipped_File_Name, NDVI_Save_Location_and_Extension)

I was trying to find a way to export them to a known colour ramp. Thus, a dummy layer is created and applied the desired colour ramp to it. Later, for each NDVI field image, just applying the colour ramp by the following codes

arcpy.ApplySymbologyFromLayer_management(in raster, color ramp layer)

 

It works. But I would like to export those NDVI images in the colour ramp I applied. Is there any way to do that in ArcPy?

Outcomes