I have a shapefile containing 38 polygons i.e. 38 states of a country. This shapefile is overlaid on a raster. I need to extract/reclassify pixel above a certain value, specific to each polygon. For example, I need to extract the raster pixels> 120 for state/polygon 1, pixels> 189 for polygon 2 etc with the resulting raster being the extracted pixels with value 1 and everything else as NoData. Hence, it seems like I need to extract first and then reclassify.
I have the values, for extraction, saved as a data frame with a column containing names, matching the names of the states,which is stored as an attribute
"Name" in the shapefile.
Any suggestion on how I could go about this? Should I extract the raster for each state into 38 separate rasters, then do
reclassify() and then
mosaic to make one raster i.e. the country?