2

I Have 172 Raster, and need to change the cellsize. So I use Export Data from TOC enter image description here

and change the cellsize manually (example I want to change it to "3") enter image description here

I tried using this python script to create input and output folder (because batch output in resample had to be filled one by one and I just want to let all value as default including file name except for cellsize)

import sys, os, arcpy

InRaster = sys.argv[1]
OutRaster = sys.argv[2]

InFolder = os.path.dirname(InRaster)
arcpy.env.workspace = InFolder

for Ras in arcpy.ListRasters():
    arcpy.AddMessage("Processing " + Ras)
    #arcpy.RasterToOtherFormat_conversion(InFolder + "\\" + Ras , OutRaster ,"TIFF")
    arcpy.CopyRaster_management(InFolder + "\\" + Ras , OutRaster+ "\\" + Ras ,"DEFAULTS","","","","","")
    arcpy.AddMessage("Done")

Setting Properties :
enter image description here

When I try to add Input folder and Output Folder it has different submit enter image description here

enter image description here

Result in error :
enter image description here

Is there any way to do it automatically or fixed for my python code to process multiple raster at once?

9
  • This looks related (just needs to modify output cellsize rather than format) gis.stackexchange.com/questions/107700/…
    – PolyGeo
    Sep 24, 2014 at 9:31
  • where should I put the cellsize command in arcpy.CopyRaster_management(in_raster, out_rasterdataset) ? Sep 24, 2014 at 10:17
  • geoprocessing > environment setting >raster analysis, but I recommend my answer which is more specific to your problem ;-)
    – radouxju
    Sep 24, 2014 at 10:19
  • From its tool documentation you will see it has a lot of other parameters but it does not have cell size after all (my mistake). The answer by @radouxju looks right to me.
    – PolyGeo
    Sep 24, 2014 at 10:22
  • Can I join the command using script from here? resources.arcgis.com/en/help/main/10.1/index.html#//… Sep 25, 2014 at 0:53

1 Answer 1

2

For full control on the change of cell size, you can use the Resample tool (data management). You can then select the best resampling method for your dataset (most of the time, your best choice will be MAJORITY for categorical data and CUBIC for continuous data).

You can run this tool in batch by right-clicking (> Batch...). You can then select all your files with "browse", then you enter the new cell size on the first row and you right click on this row (> "fill") in order to assign the same cell size for all rasters.

1
  • which resampling method should I use, I just want to change the cellsize but leave any other than that as default. and about output dataset, should I define it one by one? if yes, then it's the same with manually export it one by one. Basically I want to change only cellsize of multiple raster automatically and leave the rest as default including filenames. Sep 25, 2014 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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