I have shapes with attribute BLUE. I have shapes with attribute ORANGE.
The attribute table has two entries - BLUE, ORANGE - even though there are more isolated shapes ( islands in fact).
I wish to find the centroid of the dominant (largest by area) shape BLUE and the centroid of the dominant shape ORANGE. Red DOTS in image.
I suspect there must be a way to ignore the non-dominant island shapes and then find centroid of dominate shape.
The purpose is that I want to determine LAT-LONG of the centre of shape in order to place Capital name there.


x(centroid(coalesce( order_parts( $geometry, area($geometry), False)))) and y(centroid(coalesce( order_parts( $geometry, area($geometry), False))))
– Babel Sep 13 '19 at 21:19x(centroid(coalesce( order_parts( $geometry, area($geometry), False))))didn't work for me. After trial and error,x(centroid(geometry_n(order_parts($geometry,'area($geometry)', False),1)))worked. Note it should be'area($geometry)'instead ofarea($geometry). – user10253771 Nov 24 '21 at 08:48