[Qgis-user] Point order in WKT export from polygon layer
Reetz, Michael (NLPVW) Michael.Reetz at nlpvw.niedersachsen.de
Mon Aug 5 05:33:31 PDT 2024
I've created a csv-file with coordinates in WKT-format by exporting a polygon layer with the
"Save object as ..."-option ("Objekte speichern als ..." in the German QGIS
version). I need this for querying data from GBIF via their API using JSON input. That has worked
for the last years. But using the same JSON files this year gives an error because the point order
is clockwise. I've found that according to the OGC standard the order should be counter clockwise
for polygons and clockwise for excluded areas inside a polygon. It seems as if GBIF is following
this standard now.
Hi Michael,
I suppose you are exporting the layer in the CSV format using the Layer
option GEOMETRY = AS_WKT.
Instead, I suggest you to use the Field Calculator to add a real or
virtual field for such layer and populate it with the WKT representation
of the geometry [1]. You can force a particular winding of the geometry
using either the force_polygon_ccw [2] or force_polygon_cw [3] function.
For example, using the following expression:
geom_to_wkt( force_polygon_ccw( @geometry ) )
Best regards.
Andrea Giudiceandrea
[1] geom_to_wkt function
https://docs.qgis.org/3.34/en/docs/user_manual/expressions/functions_list.html#geom-to-wkt
[1]
https://docs.qgis.org/3.34/en/docs/user_manual/expressions/functions_list.html#force-polygon-ccw
[2]
https://docs.qgis.org/3.34/en/docs/user_manual/expressions/functions_list.html#force-polygon-cw
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user