I need to create a fishnet grid (presence and absences) form species distribution areas (polygon shapes). But I need to define that presence (value 1) is correct when more than 30% of the grid is covered by the species distribution area. Any ideas of how to do this?
- Create a vector grid with required settings(extent, spacing) and choose output type as polygon
vector > research tools > vector grid
- perform an intersection with the species distribution layer.
vector > geoprocessing tools > intersection
- Calculate the area of each polygon of the newly generated layer.
- join a area attribute to grid layer
create the presence /absence field using field calculator and generate values using if condition after determining the area of 30% coverage and replace 30 with that area.
if( "intersection_area" > 30, 1, 0 )
- First make sure your fishnet layer has a unique ID field, we'll assume it's called
- I would assume that each feature in your fishnet layer has the same area, but just in case calculate the area for each feature in a new field called
- Run the Intersection tool under the Vector -> Geoprocessing Tools menu. Choose your fishnet layer for the input layer and your species distribution layer for the intersect layer.
- Open the attribute table for the new intersected layer and then open the field calculator. Make sure Create a new field is selected and give it the name PROPORTION. Set the Output field type to Decimal number (real). For the expression use
$area / "AREA"
- Right-click on the original fishnet layer in the Layers Panel and choose properties, then go to the Joins panel. Add a new join, select the intersection layer as the join layer, the join field should be
Id, and the target field should be
Id. You can toggle the Choose which fields are joined box and select the PROP field.
- With the join complete open the attribute table for the fishnet layer. Open the Select by expression tool and use the expression
"Intersection_PROP" >= 0.3. This should select all the features in your fishnet where at least 30% of the feature is covered by the species distribution polygon.
- You can then use the field calculator to set the value of your presence/absence field to 1 for the selected features.