i have a tiff image that into Arcmap i clip with Data Frame Clip using a shp file into data frame as mask to clip and i have the result that you can see into this image
instead when i create a python script i can't use clip data frame so i use clip_managment or extract by mask with the same shp file but the result is different, you can see in this second image
You can see that the bouds of clip are not smooth as first clip resulted by clip data frame.
How i can resolve this problem and have the same result with bounds smooth?
in order to get the smoother edge, you have to explicitly set the cell size in the Environments tab of the tool. If you don't, it defaults to 1/250th of the maximum of the extent with or height. So when opening any tool in Arctoolbox, the first place you should go to is the Environments Tab and set your raster properties (there are a couple of places inside)
would be nice to mention that as well, but as usual, there is an arcpy interface... see the examples in Environments section of arcpy and those that apply to raster processing.
Hi Dan this is my script
print "Start script"
arcpy.env.cellSize = 0.1
env.workspace = arcpy.GetParameterAsText(0)
date = arcpy.GetParameterAsText(1)
excludedValues = arcpy.GetParameterAsText(2)
mxd = arcpy.mapping.MapDocument("Map.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")
strNdvi = "ndvi.tif"
strNdviLayer = "ndviLayer.lyr"
Temp_Symbology = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ndviLayer.lyr')
# Generate NDVI
strRedImage = "Image1.jp2"
strIVImage = "Image2.jp2"
strPolygons = "polygon.shp"
strPolygon = "polygon"
sr = arcpy.Describe(strRedImage).spatialReference
df.spatialReference = sr
if not arcpy.Exists(strNdvi) and arcpy.Exists(strRedImage) and arcpy.Exists(strIVImage):
rasNdvi = Divide(Minus(Float(strRedImage),Float(strIVImage)),Plus(Float(strRedImage),Float(strIVImage)))
print "NDVI created."
the ndvi created have a cell size 10 x 10 , i have used Describe to see
and this is the rest of code
lyrNdvi = arcpy.mapping.Layer(strNdvi)
lyr = arcpy.mapping.ListLayers(mxd)
##Clip Raster Dataset with feature geometry
arcpy.env.cellSize = 0.05
arcpy.Clip_management("ndvi.tif", "#", "ndvi_clip.tif",strPolygons, "0", "ClippingGeometry")
print "clip ok"
and the result is the second image, with bounds not smooth