[Qgis-user] How to make diagonals

Etienne Trimaille etienne.trimaille at gmail.com
Thu Feb 3 23:43:52 PST 2022


Maybe "oriented_bbox" to get first a proper rectangle ?
https://docs.qgis.org/testing/en/docs/user_manual/expressions/functions_list.html#oriented-bbox

But then, you might have some tiny leftover. It depends if you care or not.

Otherwise, you need to use the angle at each points.

I thought there is the longest line possible within a polygon, but I can't
find it. I did it manually a few years ago.

Le jeu. 3 févr. 2022 à 23:29, Dario C <dario955i at gmail.com> a écrit :

> Hi,
> I have several rectangles (almost squared) and I'd like to represent
> their diagonals.
>
> I started to do with geometry generator with:
> make_line(point_n($geometry,1),point_n($geometry,4))
> and
> make_line(point_n($geometry,2),point_n($geometry,5))
>
> Unfortunately, even if they look rectangular, actually they have more then
> 4 points and, moreover, points do not always have the same order.
>
> here below an example:
> [image: image.png]
>
> Is there any expression in order to pick the two longest segments
> connecting all the points of the geometry?
>
>
> Thanks
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220204/a44ea237/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9834 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220204/a44ea237/attachment.png>


More information about the Qgis-user mailing list