3

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.

3
  • 5
    Possible duplicate of Maximum altitude in polygons
    – Shiko
    Commented Aug 26, 2018 at 22:01
  • Use zonal stats tool.
    – csk
    Commented Aug 26, 2018 at 23:03
  • 2
    The question is not duplicate. The other question asks how to get max value, this asks how to get point with max value. Commented Aug 27, 2018 at 7:42

1 Answer 1

2

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.

3
  • does not work. In the second step the following error appears: Feature (0) has invalid geometry. Please fix the geometry or change the Processing setting to the "Ignore invalid input features" option.
    – Luna
    Commented Aug 28, 2018 at 0:50
  • @HeitorNóbrega You do have to fix the geometry of your polygon layer. Nothing works with bad data.
    – Kazuhito
    Commented Aug 28, 2018 at 1:09
  • this worked great for me, thanks! Commented Mar 29, 2021 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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