How to select a point by minimum coordinates in QGIS

Viewed 97

I have a point layer in QGIS (extracted vertices from a polygon). I need to select automatically the point which has the minimum X and minimum Y coordinates (the lowest on the left), for any geometry.

I know I can select by expression the minimum coordinate:

"ycoord" = minimum("ycoord")

But I do not know how can I select with "minimum Xcoordinate AND minimum Ycoordinate"

"xcoord" = minimum("xcoord") AND minimum("ycoord")

it does not work.

Thank you in advance for your help!

Image of an example of polygon

2 Answers

Try this: "xcoord" = minimum("xcoord") AND "ycoord" = minimum("ycoord")

I suggest you to do it this way: $x = minimum($x) AND $y = minimum($y) and now you don't need to calculate a field with x and y coordinates.

As far as I can see, your proposed solution tries to find a point that does most of the time not exist i.e. with the coordinate pair of the botttom left point of a bounding box encompassing your points.

I suppose you are actually looking for the point with the smallest distance from said point.

I'm not sure if select by expression is the right tool for that, but you could do something like this, which selects the point with the minimum distance to the bottom left corner of your bounding box :

intersects_bbox($geometry,buffer(make_point(minimum($x), minimum($y)),minimum(distance($geometry,make_point(minimum($x), minimum($y))))))

You could also use some hotfix like selecting the minimum of x using a subset of points where y is smaller then the mean of y:

$x = minimum($x,"",$y<mean($y))
Related