I am trying to understand how nearest neighbor for the resampling of Image datasets works in ArcGIS.

The output raster cell value is the value of the closest cell value in the input raster: enter image description here

In this case the center of each output cell is the middle cell of each 3x3 input cells.

what happens if they are all at the same distance? if the output has half the dimension of the input, the center of the output will have the same distance to the 4 closest neigh input cells ?


He gets the majority of cell values? No

Or am I missing something here?

  • Have you tried it out? Maybe you could create a test raster and run an experiment. I for one, am interested.
    – R.K.
    Commented Feb 15, 2012 at 12:20
  • 1
    "Nearest neighbor" is independent of "majority." When you use an NN procedure, there's no reason to expect the software to resort to majority decisions! Resolving ties in distance also will be projection-independent, because grid calculations are always done in a flat (Euclidean) space. So the only issue with NN is whether ties are resolved in some systematic way or randomly or arbitrarily. You seem to answer this in your text: you state that experimentation shows the lower right point is used. What, then, is your question?
    – whuber
    Commented Feb 15, 2012 at 16:22
  • 3
    Those diagrams are quite useful. I would imagine that the rule (ie. bottom right cell) is based on the order of processing the cells. If processing proceeds first from left to right then top to bottom, each distance from the input cell center to the output cell center is calculated and this distance becomes the minimum distance (and nearest neighbor) if less than or equal to the current minimum distance. Because the right bottom cell is processed last, it 'wins'.
    – grovduck
    Commented Feb 15, 2012 at 16:56
  • 1
    A.R., You have done such a nice job illustrating this and investigating the behavior that I would encourage you to (a) edit the question to focus on the NN behavior only (leave out the speculations about majority) and (b) put the answer in a reply. I would happily upvote both of them!
    – whuber
    Commented Feb 15, 2012 at 17:31
  • 1
    grovduck, that is possible. Alternatively, the software might just be rounding values up: rows are indexed from top to bottom, columns from left to right. When a cell center coordinate comes out exactly halfway between two original cell centers, rounding upwards produces the result @A.R. found. This approach is more efficient than looking for nearest neighbors (and finding four and having to decide among them): each output cell center results in a unique input cell to reference.
    – whuber
    Commented Feb 15, 2012 at 17:34

3 Answers 3


Following R.K. suggestion, I have made 3 diferent rasters to test the NN resampling method in arcGIS and when passing from InRas resolution to a resolution that is 1/2 of it, the value of the new cell is allways given by the lower right input cell.

On the left the different InRas files I've created (cell size1, 6x6), on the right the output of the Resampling Tool with Nearest Neighbor with output cell size of 2.

They usually recommend this method to be applied when resampling land use datasets, however I would probably go for a majority filter instead of a NN.

enter image description here


I looked up the NN algorithm in several remote sensing textbooks and everywhere it is stated that the algorithm "selects the value of the pixel center closest to the x,y location".

the question that should interest now is where the particular locations are in your different cases? for the 3x3 example it was in the center of the 6x6 block. in the 2x2 case it is in the lower right. hence it seems that the location of the 'x,y location' changes, perhaps because a 'target block' with even numbers does not have a center. I guess every programmer choses another corner for that special case.

further, in the textbooks the authors often illustrate resampling techniques with a 'target pixel' rotated by 45° and then laid onto an pixel of a larger image. in those examples it becomes clear where the "center location" is. however I think these are not well suited to explain 'resampling'...

hope that helped?


Nearest Neighbor calculates an index value based on the average distance from each feature to its nearest neighboring feature. For raster images, it is recommended that cell size be similar. If cell size and resolution are not the same, the coarsest resolution becomes the parameter for the resampling calculation. Remember that the attributes will reflect the resolution of the original source. For more detailed info on raster cell size resampling you can go to the ArcGIS Resource Center using the following link: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00590000001m000000

  • 3
    Could you provide a little more explanation about what this "average distance" is and what exactly you mean by "features"? AFAIK, nearest neighbor is what it sounds like--assign the value of the nearest cell to a new point--and does not involve averaging distances at all.
    – whuber
    Commented Jun 3, 2012 at 17:35

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.