Selecting contiguous area with raster in ArcMap?

In ArcMap 10.4, I have created a slope raster from a DEM and am trying to select only contiguous areas of slope less than 10 degrees. I have used the raster calculator to select that subset of slopes (shown here in pink), but I only want to include areas that are contiguous (i.e. no gaps between pixels, as seen in the one linear raster area below, which is a road).

I would also like to rule out areas of the slope raster that have significant pockets of slopes that are steeper than 10 degrees (as seen in the blobs on both sides of the road).

Is there a focal or zonal function that can do this?

• Is your slope less than 10 a binary raster? you could do a Con with FocalSum to reduce some of the speckles but in reality there's not a whole lot you can do to get just the road from that background noise... from here I would try a slight speckle elimination then vectorize (raster to polygon) and manually select the road for extraction.. how much of this do you need to do? How automated do you need it to be? – Michael Stimson Mar 22 '17 at 22:33
• No, it's a File Geodatabase Raster Dataset, not a binary raster. I'm playing with various combinations of Focal Stats (being sure to include the NoData cells in the calculation), but not getting anything that really gets rid of the small "islands" of slope areas. I can say that any road area will include a Circle of radius 4 (this essentially allows for a diameter of 8 cells, equal to 4 metres, which is a minimum width to be considered a road), but that's not really helping me a lot. – grego Mar 22 '17 at 23:23
• Binary raster means cell values of 0 or NoData (false) and 1 (true) not the format it's stored in. Using a Con(FocalStat can get rid of some speckles.. the logic is if the value is true and the sum of the true values in an area is greater than an arbitrary value then keep true otherwise be false Start low like 25% of a circle to clean out the worst speckles. – Michael Stimson Mar 22 '17 at 23:55
• I am not fully in support of this sort of cut-off based classification (since a relatively small change tend to yield drastically different results, say what happens if you picked 11%, what is the practice-led implication of this change), I can advise you to first process your data to fix small gaps and isolated islands as explained in another GIS SE post and then to use Region tool to isolate each part/chunk followed by a Cell Count based elimination via Con. – fatih_dur Mar 23 '17 at 0:01
• Thank you @fati_dur, your approach seems promising. I have gotten reasonable results so far by using a combination of FocalSum on my LowSlopes binary raster, and a DSM minus DEM differencing (to show me only areas of open ground). Selecting just the common areas in these two rasters results in a good visual basis for manual road selection. I will check out the gap-filling method you suggested and then the Region tool. – grego Mar 25 '17 at 0:49