Select to view content in your preferred language

Selecting area from raster

5884
7
08-09-2017 11:53 AM
AnnieCahill
Occasional Contributor

I have a simple raster (each cell size is one meter).  From the raster, I need to select areas of contiguous cells which are 50 square feet or larger.  Is there a tool which can give me the results I need?

0 Kudos
7 Replies
DavorGugolj
New Contributor

There may be a more elegant approach, but this is one solution...

* Assuming your raster cells are discrete values (e.g., integers, classification). Also assuming that the raster isn't huge.

1. Convert the raster into polygons (Make sure "Simplify Polygons" isn't checked)

2. Once you have your polygon feature class - run a Dissolve based on the values (Do not create multipart features)

3. Create a new field and calculate area in sq. ft.

4. Select by attribute for areas >50 sq. ft.

Done! But, if you need to go back to a raster for further processing (e.g., masking) ...

5. Create a field in the dissolved polygon feature flagging the polygons that are >50 sq. ft (e.g., those areas = 1, all others = 0)

6. Dissolve based on that field (Again, do not create multipart features)

7. Convert polygon to raster based on that field. (Make sure you set the raster cell size to 1 m, and set the Raster Snapping in Environmental Variables to the original raster, so that the pixels line up)


Good luck!

0 Kudos
MervynLotter
Frequent Contributor

An alternative approach to keep your data in raster format would be to run the Region Group GP tool. This will create a new raster with a count field. To calculate size simply multiply the count field by the size of your pixels in m2. You are fortunate as your pixels are 1 x 1 m so your count field should be equal to your size in m2. Otherwise, if the pixel was say 30 x 30 m, then to determine size would be: Count x 900 (30x30). 

Then run the Select Layer by Attributes tool to select those groups greater than your threshold size. 

0 Kudos
AnnieCahill
Occasional Contributor

Thank you both for your replies.  I was researching the Region Group tool but I got confused about the number of neighbors option so I haven't tried it yet.  The problem I ran into with running it using Davor's suggestion is that I ended up with polygons which met the area requirement but were too narrow for a landing site.  I do need a result that's closer to a square so I'll try this tool and see if it gets me closer to what I need.  Thank you again!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Mervyn's approach is the quickest and it also has the added advantage that you can...

  1. perform a query first... ie identify all the public lands only for inclusion.  By querying for public lands (whatever class that happened to be) you end up with a binary raster of 0 and 1's
  2. Regiongroup the 1's (ie public lands), determine your candidate zones that meet the size criteria.
  3. Now!!!...the size and shape of the zones is important as well.. at this step I would use Zonal Geometry or Zonal Geometry as Table to get area and other shape measures.

Why bother?  there is no point having a 50 sq ft parcel of land that met a size requirement, but was 1 foot wide by 50 feet long is there?  You can look at perimeter/area ratios, thickness bounding ellipsoid parameters (a axis = b axis is a circle, hence bounding a square) or even orientation to determine the prime candidate... "I need a 50 sq ft parcel of land on a south facing slope with a width/height ratio no more than 5"  Anticipate the next question if you can

0 Kudos
AnnieCahill
Occasional Contributor

Thanks Dan, we were both responding at the same time.  You are spot on about the shape issue and I will try your suggestion.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Thanks Annie...now for the neighbour issue whether 4 or 8... I tend to run both and then do a difference between the results to see if the geometry arrangement of the cells produces any exceptionally small zone artifacts.  Neither is right or wrong... but if in doubt...  8 is good... it looks like two circles

0 Kudos
curtvprice
MVP Esteemed Contributor

This is a job for... Raster Calculator!

Assuming you have a landownership raster where VALUE=4 cells are public lands:

groups = RegionGroup(Con("landown" == 4, 1))
sites = SetNull(ZonalGeometry(groups,  "VALUE", "THICKNESS") < 50) |
                ZonalGeometry(groups,  "VALUE", "AREA") < 2500, groups)‍‍‍‍‍‍
0 Kudos