I would like to create a raster where each cell equals the distance to the nearest cell >= the value of the source cell plus a constant. In the example below, the input raster has a grid size of 1m x 1m. Assume we are adding constant of 2 to the cells. For the top left cell, the distance to the nearest cell that contains a value >= 5+2 is 1.0m. I don't think any of the distance tools in ArcGIS will do this.

Input raster:

Input raster

Contant = 2

Output raster:

Output raster

  • Not the smartest here, but I would say that the GetCellValue (Raster tool), ArcGISPro or python/numpy could solve your problem.
    – Delonix R.
    Mar 24, 2016 at 17:04
  • 1
    Question: Input[0,0]=5 and its inmediate neighbor holds 8 (which is less than 5+2) then Output[0,0]=1. All good here. But Input[4,1]=5, then why Output[4,1]=1.4, same in Input[3,4]? If your cells are 1sqm, why you have decimals in your output?
    – Delonix R.
    Mar 24, 2016 at 17:15
  • @Delonix R. I'm not sure why that cell with the value 5 doesn't have a distance of 1 since it's neighbor on the left has a 9 (probably a misabstake), but the decimals are there because it's a euclidean distance and it's measuring a diagonal, so the cell adjacent on a diagonal is 1.4 (square root of 2).
    – karl
    Mar 24, 2016 at 17:40
  • Correct, karl. The answer for 5 in bottom row should be 1. It was late and I was getting tired!
    – rider
    Mar 28, 2016 at 12:02

1 Answer 1


Assume input is intreger.

Take 1st value, 1 in above example.

A=Con(input GE 1+2, input)

B=Con(input==1, input)


E=Con( is not null(B), D)

Save E. Proceed with next record

Mosaic saved rasters

Not sure why answer for 5 in bottom row != 1

It is very few lines of script in arcpy, run and go home

  • thank you FelixIP, I will try your suggestion and report back. I never thought to treat as a mosaic, good idea. The answer for 5 in bottom row should be 1. It was late and I was getting tired!
    – rider
    Mar 28, 2016 at 12:00
  • Hi @FelixIP or others, can you please provide additional detail to the expressions above? My python experience in non-existent, so syntax shortcuts have me confused.
    – rider
    Mar 12, 2017 at 12:23

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.