Can anyone suggest a QGIS/R approach to sample from a polygon n points that satisfy some conditions depending on underlying raster layers values?
E.g. I have a country polygon and I would like to sample 10 points such that for those points the population density (density_raster) is >100 and altitude (altitude_raster) is <1000.
Use the Raster Calculator to create a raster that is equal to 1 anywhere the
population density > 1000 condition is satisfied and where the altitude raster's condition (
< 1000) is also satisfied.
Polygonize the output raster. Use a definition query on the result to only show the areas with a value of 1. This area is now a polygon representation of the areas where both of your conditions are satisfied.
Now use Vector > Research Tool > Random Points Inside Polygons with your intersected polygons and specify whatever other parameters you deem appropriate.