I have a mosaic raster of an agricultural area. In the mosaic raster, a specific agricultural field (field no. 5) looks just like this
When I clip the raster with the field's shapefile (shapefile of the field no. 5) the color changes a bit and looks like the following image.
The following codes have been used to clip the mosaic raster -
#clipping the raster
arcpy.Clip_management(in_raster= mosaic_pan_layer, rectangle=str(extent_of_shape_file),
out_raster=pan_save, in_template_dataset=shape_file, nodata_value="65536",
#saving the clipped raster
arcpy.CopyRaster_management (in_raster = pan_save, out_rasterdataset = Clipped_pan_save, nodata_value = "9999")
I also have done the following -
- mosaic image > properties > symbology > save the statistics in xml . Then went to the symbology of the clipped result image > "rgb composite"> type = "custom" > statistics = "from custom settings", and loaded the statistics using xml.
Here is the results -
The result is -
The mosaic image has some black portion where the pixel values are 0
Is there any way to get the clipped raster to look exactly the same as the mosaic layer?
If the range of values changed and the symbology doesn't then they would appear different since the range of colours would be different. You want the coloration to stay the same which means it would not be dependent on the values but only the range.
The first thing is to make sure no values was changed. You do this by identify a few points when both rasters are visible and the identify option is visible layers.
Then you need to transfer the symbology. I found the easiest way to do it is to save lyr file from the original image and set the data source to the new one.