I have created a Point dataset by using the Saga routine 'Convert Lines to Points'. This produces the following look and attribute table: Points in QGIS

Attribute Table

Can anyone advise on how I can extract the maximum value from each 'ID' set (red polygon in image) and then add the correct XY position of that single (maximum value) point?

What I want to end up with is a list / table showing only the maximum value and XY coordinate for each cross line of points.

There are over 350 unique 'ID' sets within the attribute table, so the end table / file should contain 350 maximum values and coordinates.

Update... I have a shapefile of the data in question but I can't work out how to add it to this question! Can anyone advise please?

  • 2
    Can you share your data, at least a sample? Like this, it's not clear to me what you have - and what you want to achieve: what should your final goal look like?
    – Babel
    Sep 17, 2021 at 15:41
  • I have a file to share with you but can't work out how to add it to the question or response (sorry, I am new to this forum). I'll see what I can do.
    – Tim W
    Sep 20, 2021 at 6:06
  • You can't post files here, you must use an external fileshsring service and post the link here.
    – Babel
    Sep 20, 2021 at 6:26
  • I have now uploaded the sample file at the following link...we.tl/t-vX35UYZBrY
    – Tim W
    Sep 22, 2021 at 6:17
  • The final goal would be to have the initial dataset analysed to extract from each cross line of points the maximum value (height) with its associated XY coordinate. This dataset would then be a line providing the highest depth values.
    – Tim W
    Sep 22, 2021 at 6:23

1 Answer 1


Use this expression in field calculator. Be aware: array_max works only with QGIS versions 3.18 or higher:

    array_foreach (
            map_akeys( attributes( )), 
            left (@element,1)='X'

enter image description here

  • I have tried this but it results in an error... 'Expression is invalid'. I have tried both the text from above and also the text within your screen grab.
    – Tim W
    Sep 20, 2021 at 6:08
  • What QGIS version do you use? Some parts of the expression work with newer versions only: array_max since QGIS 3.18: qgis.org/en/site/forusers/visualchangelog318/…
    – Babel
    Sep 20, 2021 at 7:02
  • I am currently using 3.16, so thanks for the response - I'll look at upgrading and testing the expression
    – Tim W
    Sep 22, 2021 at 6:10

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.