4

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?

asked Sep 17, 2021 at 15:10
9
  • 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? Commented 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. Commented Sep 20, 2021 at 6:06
  • You can't post files here, you must use an external fileshsring service and post the link here. Commented Sep 20, 2021 at 6:26
  • I have now uploaded the sample file at the following link...we.tl/t-vX35UYZBrY Commented 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. Commented Sep 22, 2021 at 6:23

1 Answer 1

1

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

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

enter image description here

answered Sep 17, 2021 at 16:06
3
  • 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. Commented 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/… Commented 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 Commented Sep 22, 2021 at 6:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.