I want to do an Ordered Weighted Averaging (OWA) analysis using SAGA in QGIS (not by using pyqgis) as a suitability assessment for recreation/restoration of specific habitats.

There's a number of both positive and negative factors to include in the overlay for which I have .shp polygon files, clipped to my study area. I've converted everything to raster as 10m squares ready for the analysis.

When I tried to run the OWA I got an error saying:

input layers do not have the same grid extent.

When I checked I saw my rasters didn't line up with the source vectors properly (see below).

enter image description here

The misalignment doesn't seem to be consistent, it's out in different places for each raster/vector pair (despite the original vectors all being aligned) & isn't just a shift in one direction so guessing I've missed a setting somewhere? I checked the CRS is consistent so it isn't that. I tried using the align rasters tool (it messes up all the values).

I then wondered if because the vectors cover different extents within the study area (see below) I need a complete grid including areas with no data for each raster for the OWA to work anyway. So I tried the Grid (interpolation) tool on two vectors using inverse distance to power and making sure the extents were exactly the same to fill all the empty grid squares. When I run the OWA again just on these two rasters I get a 'list index is out of range' error.

enter image description here

The problem is that you create a raster from two different geometries (feature classes). Whenever a vector geometry is translated to a raster it starts at one corner (top left for example). As two different geometries nearly never will have the exact same extent (bounding box) coordinates the resulting rastercells are not exactly on top of each other. As most raster calculation won´t cut raster cells into parts they need to be perfectly on top of each other to be processed.

You can solve this by creating two exact rasters or adding values from both .shp to a common raster.

The first should be possible by entering the exactly same coordinates at "output extend" together with the same cell size in the rasterize-tool or v.to.rast-tool from the processing toolbox. You can use some extent that is a bit larger than your area of interest.

The second option is possible for point-geometries only with the Grass function v.what.rast from the processing toolbox or with ST_AsRaster from Postgis for all geometry types. But both tools require further processing of your data and are possibly to complicated and should be considered when the first does not work.

  • OK, I made two more rasters using the same vector polygon layer as 'output extent' which seems to have aligned the cells. However, running the OWA still returns the error 'list index out of range'. I'm not sure what this means or how to fix it...? – Caroline May 28 at 15:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.