I have a shp with more than 1700 polygons on a elevation raster.
I need to plot a point that represents the highest altitude location within the polygons, and then export those points as a new shp.
I have a shp with more than 1700 polygons on a elevation raster.
I need to plot a point that represents the highest altitude location within the polygons, and then export those points as a new shp.
I first thought of recommending an approach here Extract highest point in raster and convert to point vector, but the large number of your polygons (1700) gives another challenge, so let me suggest a three-steps way as below.
(1) Run SAGA Raster values to points
tool (in Processing Toolbox | SAGA | Vector <-> Raster). Select your elevation raster layer (let's call it elevation
) as Grids. You may of may not assign your polygon layer to Polygons
option. This will give you an extracted point layer (Shapes
).
(2) Start Join attributes by location
tool. Select Shapes
layer as the Target vector layer and polygon layer as Join vector layer. (Any predicate will do: e.g. intersects). This will return a Joined layer
point shapefile which has polygon id (let's say fid
) field added onto the Shapes
layer.
(3) Start Extract by expression
tool (in Processing Toolbox | QGIS geoalgorithms | Vector selection tools if it is QGIS 2.18). Expression would be "elevation" = maximum("elevation", group_by:= "fid")
. This will return a new point shapefile layer Extracted(expression)
which is the highest point within each polygon.
Please note the above expression can extract multiple "highest" points if there are cells of the same highest elevation.