# QGIS - Calculate Highest Elevation within 1 degree grid

I have downloaded country raster elevation data from Diva-GIS and added 1 degree grid from "View >> Decorations >> Grid" as seen in the image below. Now, I want to know the highest elevation within each grid, how do I get this done?

The View -> Decorations -> Grid will not create a feature class grid for you. If you want to create a vector feature class grid, you need to use Vector -> Research Tools -> Vector Grid:

• Select the DEM as input Grid Extent
• Use Update extents from layer
• Use 1000 m grid (1 km)

You need to make sure that your DEM is projected to meter unit such as UTM projection

• Select Output grid as polygon
• Save the output file

Again you need to make sure that both DEM and the output vector grid has the same projection and in meter unit. Then you can use Zonal Statistics from Raster -> Zonal Statistics -> Zonal Statistics

• Under Raster select the DEM
• Select the Polygon Grid created in the previous step
• Choose Maximum from Statistics to calculate

It will update the attribute table of grid vector layer by adding a new column of Maximum pixel value within each grid

If you are OK with a command line, take a look at gdalwarp, where you can aggregate the maximum pixel on a new raster. It may look something like:

gdalwarp -t_srs EPSG:4326 -r max \
-te lonmin latmmin lonmax latmax -tr 1.0 1.0 -r max \
DEM_orig.tif DEM_1deg_max.tif


Use -te to define the extent of the raster you need. The result should be a pretty small raster file DEM_1deg_max.tif. You can also try other aggregate statistics to -r resampling_method, such as min, q3, etc. Give it a go!