0

I'm new to qgis, I just need to retrieve from the selected polygons their coordinates list.

I want to use python's console with a script. I'm using QGIS v3

This is a sample of my bare attempt to do so: enter image description here

closed as off-topic by PolyGeo Jun 21 '18 at 10:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    make sure you post all code and related error messages correctly formatted ({} button) so they are selectable for copy-paste etc. – ThingumaBob Jun 21 '18 at 10:03
2

The method family to export a QgsGeometry object's geometry representation into available formats has changed with QGIS 3.0 into QgsGeometry.as[Format](), e.g.

for i, elem in enumerate (layer.selectedFeatures()):
  geom = elem.geometry()
  wkt = geom.asWkt()
  print("element: ", i, "wkt: ", wkt)

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