4

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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
I agree
  • 165
  • 4

1 Answers1

13

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))
 )
)
MrXsquared
  • 34,292
  • 21
  • 67
  • 117
  • Sorry about being so late with a follow up question, but does somebody know how to convert the x and y values into latitude/longitude values? – I agree Sep 19 '22 at 08:34
  • 1
    https://gis.stackexchange.com/questions/7199/calculating-latitude-and-longitude-of-points-using-qgis/375071#375071 – MrXsquared Sep 19 '22 at 15:45