3

I have a layer with several polygons in it and would like to find out the maximal extend of each polygon in each direction, e.g. the western- and easternmost point etc.

Just tracing the polygon with the cursor and checking the coordinates seems a little imprecise.

How would I go about that?

1 Answer 1

12

Open the fieldcalculator and use these expressions:

x_min($geometry), x_max($geometry), y_min($geometry), y_max($geometry)


To get the entire point geometry, not just x or y value, you can get all vertices and test whether its x or y value is maximum, like this:

geom_to_wkt(
 array_first(
  array_filter(
   array_foreach(
    generate_series(1,num_points($geometry)),
    point_n($geometry,@element)
   ),
  y(@element) = y_max($geometry)) -- change the filtere here depending on which point you want. E.g. to x(@element) = x_min($geometry))
 )
)
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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