[Qgis-user] extracting vertices from a multipolygon using Field Calculator Function Editor
Stefan Giese (WhereGroup)
stefan.giese at wheregroup.com
Mon Oct 18 23:14:20 PDT 2021
as a starting point:
/from qgis.core import *//
//from qgis.gui import *//
//
//@qgsfunction(args='auto', group='Custom', referenced_columns=[])//
//def zCutBox(feature, parent)://
// """//
// Calculates vertices and return the x coordinate of the first as
string//
// """//
// geom = feature.geometry()//
// vertices = []//
// for v in geom.vertices()://
// vertices.append(v)//
// return str(vertices[0].x())/
Am 18.10.2021 um 13:42 schrieb Zoltan:
> Hi Listers,
> I can't for the life of me work out the syntax/commands to use in the
> FieldCalculator->FunctionEditor for extracting vertices.
>
> I have a Polygon layer with Multipolygon rectangles at various rotations.
> I need to extract the 4 corner points so that I can calculate (and
> save in a virtual layer) lines that I can later use with
> "Processing->Split with lines".
>
> I will google for opening a new virtual layer and saving lines to it,
> but if that is quick and easy then some help there would also be welcome.
>
> Please can someone point me to a sample functions covering these
> requirements, or just fill in the gaps below.
> No, I'm not asking for someone to just write it for me.
>
> Thanks in advance,
> Zoltan
> [Having a brain-dead day :-( ]
>
>
> from qgis.core import *
> from qgis.gui import *
>
> @qgsfunction(args='auto', group='Custom', referenced_columns=[])
> def zCutBox(feature, parent):
> vertices =
>
> blah blah
> return vertices[0][0]
>
>
> --
>
> =============================================
> Zoltan Szecsei GPrGISc 0031
> Geograph (Pty) Ltd.
> GIS and Photogrammetric Services
>
> Cape Town, South Africa.
>
> Mobile: +27-83-6004028 (Signal, not WhatsApp)
> www.geograph.co.za
> =============================================
>
> _______________________________________________
> 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
--
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
---------------------------------------------
Schon gewusst?
In unserem Blog geben wir Tipps & Tricks zu
Open-Source-GIS-Software und berichten aus unserem Experten-Alltag:
https://wheregroup.com/blog/
---------------------------------------------
WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany
Fon: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11
stefan.giese at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211019/aad86011/attachment.html>
More information about the Qgis-user
mailing list