Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The raster using arcgis geoprocessing is cliped with a feature, reading it's geometry and as a result, rasters extent slightly differs. Extent of geom:

str(row.shape.extent)
'570600,537958652 381252,627022596 570698,472917815 381474,211727455 NaN NaN NaN NaN'

Extent of raster (gp and gdal - both shows same):

str(gp.Describe(output).Extent)
'570600,424994 381252,499999738 570699,424994 381474,499999738 NaN NaN NaN NaN'

DS=gdal.Open(output) 
DS.GetGeoTransform() 
(570600.424994, 1.0, 0.0, 381474.49999973783, 0.0, -1.0)

Having a raster of 1x1 m. resolution that is minor thing... The problem comes as I produce multiple smaller rasters of the same area to compare and the ones smaller I extend with gdalwarp to the shapefile geometry (the one I clip with). I need rasters of the same extent to be able to compare them with numpy. As not the clipped raster has one column more then the extended one!

As I firstly produce smaller rasters, it is easier to get extent from the row geometry instead of test clipping.

Could enyone explain why clipped raster gets other extent then planned? And how to force gp.clip_management to take the geometry extension?

share|improve this question
    
cant you create a buffer (ie empty column and row) around your raster to get the same image dimension you need? When you clip raster with vector, the extent can be different because a pixel cannot be divised this way. –  Below the Radar Jul 19 '13 at 13:05
    
I understand the pixel division, but as u see, the the extent of raster did not get rounded to well, in order to guess which data is missing, as I get just ONE ROW missing. So , I can't just delete that row, not create new with no values because data is important.. –  najuste Jul 22 '13 at 7:47
    
arcpy.env.extent = "XMin, YMin, XMax, YMax"? –  Tomek Sep 18 '13 at 15:25
    
@Tomek - With arcgis 9.3.. no arcpy available. –  najuste Sep 19 '13 at 8:23
    
webhelp.esri.com/arcgisdesktop/9.3/…? –  Tomek Sep 19 '13 at 8:34
show 1 more comment

1 Answer

Go into the environmental settings of the geo-processing tool and set SnapRaster to the extent you want.

share|improve this answer
    
Well, I'm trying to force raster to get the shp extent, not other raster extent. Snaping raster works just with rasters, which in any case means I will have to create firstly a raster to snap to.. Not a solution, but thanks. –  najuste Jul 22 '13 at 9:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.