Skip to main content
Question

Calculate cell distance between cells

  • February 19, 2019
  • 1 reply
  • 38 views

I want to calculate the cell distances between all cells within a feature class grid. Exactly the same as the game Minesweeper

I currently have the cells as a feature class within an esri file geodatabase, but can easily convert it to a raster grid.

I have included an example below. The original data contains 11000 cells with different labels but I have simplified in the example:

For each cell I want to find how many cells apart they are from all other cells.. Example here is for cell A2. I would then iterate this for every cell in the grid to produce the final csv.

I have attempted using cost distance tools within a GIS, but It's unable to cope with the data.

I have access to FME 2014, but looking through the help files I've been unable to find a way to do this.

Is anybody able to give me some guidance as to how this may be achieved?

 

Many thanks

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Celebrity
  • 7843 replies
  • February 19, 2019

The position of a cell in the matrix can be specified by a pair of column index and row index. Assuming that positions of two cells are (column0, row0) and (column1, row1), according to the rule illustrated in your screenshot, I think the distance between them can be calculated with this pseudo expression.

distance = max(abs(column1 - column0), abs(row1 - row0))