1

How can i expand extent of a raster image with Python as the image shown in below. I have the coordinate information of a raster image such as Xmin Ymin Xmax Ymax,how can i expand its extent based on the specified size(Ex, expand 10px or 1px)? I know it can be easily implemented on AML through the command such as setwindow, con(isnull ...etc, but i have no idea on ArcPy.

Does anyone know about it?

enter image description here

1 Answer 1

4

Set the Output Extent environment setting with arcpy.env.extent, then make a copy of the raster

import arcpy from arcpy.sa import * arcpy.CheckOutExtension('Spatial') arcpy.env.extent = arcpy.Extent(0,0,10,10) arcpy.env.cellSize = 1 #Dummy raster just for demonstration a = CreateConstantRaster(1) print a.extent.XMin 0.0 #Widen Extent arcpy.env.extent = arcpy.Extent(-2,-2,12,12) # Copy the raster b = a * 1 print b.extent.XMin -2.0 

Raster "b" from above code with NoData symbolized as light blue:

enter image description here

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.