Friday, 11 May 2018

ArcGIS function to subtract cell from next cell in a raster?


Using ArcGIS 10.5.1 - I have a raster with certain values (elevation in this case). I'd like to generate a raster that is based on each cell subtracted from its neighboring cell (the one to the direct left). Is there a function that would do this? Example:


Input raster:



  • 6 16 14

  • 6 10 14


  • 8 10 14

  • Desired output raster:


  • No Data 10 -2

  • No Data 4 4

  • No Data 2 4

  • Used Raster --> Float. Here is my header file


    enter image description here




Answer



If you do not want use python then this can be done with model builder, by shifting the grid left by 1 pixel, do the maths then shifting it back. Doing this introduces a column of nodata on the right so the final step is to use the original clip to clip it back to the original size.



The model would be:


Model


The important thing is to set the environment setting of the minus tool to be the union of the extents of the original and shifted grid, this allows the no data column to be created.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...