In my journey to solve a different question, I've decided to create a QGIS processing model to automatically correlate rasters to a projection (UTM) grid.
The inputs are a raster file and the UTM grid (shapefile).
The process is: get raster extent as a polygon, do a join by location with the raster extent on the UTM grid, get the correct zone, and pipe it into GDAL Warp method to output a correctly projected raster.
There is a function in the processing modeler called Raster layer bounds that I can use on the raster input, but cannot use as an input to anything else.
My question is: how do I get from the Raster layer bounds to a polygon in modeler? I see many tools for making a polygon into other things, but nothing to make a series of points into a polygon.
Perhaps I am going about this wrong and there is something that will help me extract the extent of the raster file more easily, but searching by "extent" yields nothing. There appears to be a very helpful Polygon from layer extent function, but alas, it is only for vector not raster.
Best Answer
You could create a custom script, copy the source code for the Polygon from layer extent tool and modify it slightly to take a raster as input. You can create one from:
Then use something like the following:
Make sure to save the script into your
/.qgis2/processing/scripts
directory.Example:
A simple model with a raster layer being used as an input to the script:
Here is the input raster:
Here is the result of the model:
You could take the output polygon and use that as input for another tool.