1

I am looking for a way to upsample a raster to a higher resolution without interpolating in ArcGIS and arcpy (because I have geoprocessing script which treats a lot of rasters).

For example if I have a 10m resolution raster such as in the schematic attached below on the left I would like to achieve a higher resolution of 2m but with all the same values in the single cells such as on the right side of the schematic below. All the resampling techniques (cubic and bilinear) with arcpy.Resample_management I tried so far are interpolating between the values, however I would like to have a higher resolution with same values per 10m cell (basically what I am looking for is a inversion of the Aggregate Tool in ArcGIS).

enter image description here

I found a solution which works for a single raster by using ArcGIS Export Raster Data, but I am looking for a solution in arcpy because I have a lot of rasters to process and a manual export is not an option. I am looking for a solution specifically in ArcPy/ArcGIS as I have no admin rights on my computer at work and cannot install additional packages/software (I am aware that there is a GDAL command that does this, e.g. here).

enter image description here

  • 1
    The nearest neighbor interpolation method of Resample effectively does this if new pixel size of the raster is an even divisor of the old pixel size. You might want to explicitly define the extent so it doesn't shift. – Vince May 17 at 14:59
4

The resample tool does have a method which produces the output you need, NEAREST.

ratio = some_number
cell_y = str(input_raster.meanCellHeight * ratio)
cell_x = str(input_raster.meanCellWidth * ratio)
arcpy.Resample_management( 'input_raster', 'output_raster', cell_x + ' ' + cell_y, "NEAREST")

If your input raster cells are square, you can omit defining cell_x and just call cell_y twice in the Resample statement.

As long as your value in ratio evenly subdivides your input raster cells, you'll get the output you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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