creating a buffer in a raster layer

I've got a raster layer separated into 3 zones, representative of marine park zones. What i'm trying to do is make it so that where zone 1 is adjacent to zone 3, there is a "buffer" between them, of zone 2. How would I go about this?

i want a small buffer zone of the blue zone, where ever the red and green zones are adjacent to one another. short of cracking open photoshop and drawing it in myself, is there a way of doing this: in arcmap?

• Could you clarify what you mean by "3 zones" ? How is your layer/data organized ? What do you mean with "buffer" here ? It would be easier if you supplied a screenshot describing your problem. – Oyvind Sep 4 '13 at 10:31

A good way to buffer a zone is to query the Euclidean distance grid of its indicator. You wish to replace any cells in the intersection of Zone 3 and the buffer with Zone 2 values. Such conditional replacement is done with the mnemonic Con function.

Notice this is not exactly what was requested: I understand from the legend in the figures that the intent is to erect a buffer region between sanctuary areas and general use areas. Even when the general use cells are not directly adjacent to the sanctuary cells, they may still be too close and therefore require a buffer anyway. Consequently the solution (as given here) ought to be based on distance rather than adjacency.

Here are detailed steps.

1. Equate the zones layer ("Zones") with the value of Zone 1 and apply SetNull to its result to convert all the false values to NoData. This grid--the "indicator" for Zone 1--will contain only the red (Zone 1) patch shown in the figures.

2. Compute the Euclidean distance grid of the Zone 1 indicator. Its values are the distances to the nearest non-NoData cells in the indicator: that is, they give the (straight line) distances to Zone 1.

3. Compare the distance grid to the desired buffer distance, retaining everything less than or equal to the distance. This grid ("Buffer") will have values of true (1) and false (0) only. True values are assigned to all cells within the buffer distance of Zone 1 (including all cells of Zone 1 itself, which are at distance 0).

(Here I have used a wider buffer than shown in the question so that the results will be visually apparent. For comparison, the Zone 1 indicator (red) is overlaid on the buffer(gray) so that only the parts of the buffer beyond Zone 1 actually show.)

4. Use `Con` and And to replace the cells of Zone 3 within the buffer with the code for Zone 2. The syntax varies with your version of ArcGIS and how you are interfacing to the Spatial Analyst functionality, but will roughly follow this, assuming the code for Zone 2 is 2:

``````Con("Zones" == 3 And "Buffer", 2, "Zones")
``````

Every part of this map calculation expression has a clear meaning: it has colored blue (`2`) all the green cells (`"Zones" == 3`) within the buffer (`And "Buffer"`), as seen at the bottom left, but otherwise (`Con`) it changed nothing else (`"Zones"`).