# Clipping polygon layer by raster value

I've seen many ask how to clip a raster via a polygon mask but have yet to find the opposite operation. How does one clip a polygon layer via raster? ta Specifically how does one clip a polygon layer via certain raster values?

For example imagine a flooding model. I would like to get the polygon shape that represents a "safe" area in a certain region. I would have to clip the raster extent against a certain elevatio value in the raster.

Any ideas?

• There is no tool to do that, you need to convert your raster into a polygon then clip your polygon with a polygon. You can use your QGIS raster calculator to create a binary raster from your elevation then polygonize that. Commented Jul 24, 2015 at 4:14
• Won't converting a raster to a polygon simply give it's extents?
– jhc
Commented Jul 24, 2015 at 4:18
• No. You end up with a polygon for each cell in the raster dissolved by values. No data is lost. Read gis.stackexchange.com/questions/54362/… Commented Jul 24, 2015 at 4:39
• You could use raster calculator to find certain areas based on the elevation values. The return values are a raster with the values of 1 and 0. eg if you put in an expression "DEM >= 5" any areas with elevation of 5 or greater will be shown as the 1 values (true) and everything else 0 values (false). Commented Jul 24, 2015 at 4:41

This is how you can use raster calculator to find "safe area" (note: basic analysis) using ArcGIS 10.2.

[]

• Open Raster Calculator and enter the conditions that you want to find. In the example below, I want to find areas of elevation from the DEM that are equal to or greater than 186m (186 is the level that my flood water reaches)

• The results returned from the Raster Calculator process is a new raster with the values of 1 and 0. Values of 1 represent all areas that are equal to or greater than 186m (True - see green areas in example below) and the 0 represent values that are less than 186m (False - see pink areas).

• The next step is to convert this new raster ("Area_Above_Flood_lvl.img") to a polygon shapefile using the Raster to Polygon Tool

• and then delete the 0 values in the field "GRIDCODE".

• The final result is a polygon showing the safe areas above my flood heights.

• Thank's for the help. Worked perfectly.Can't give a +1 to you though as I don't have enough rep on this account.
– jhc
Commented Jul 24, 2015 at 17:03

You were nearly there when you said clip a raster by a polygon. Essentially they're the same operation: you can clip your raster to the polygon and then mask the result to the values you require. This masked raster can then either be converted into a polygon or kept as a raster. Note, it may be easier if you convert your polygon to a raster first.