2

I currently have a layer which is composed of different areas. I want to extract the coordinates of the vertices of the shape to CSV in QGIS, which I successfully am able to do by using extract vertices. What I also wanted to do is to know which vertices belong to which "sub-area", as exemplified in the picture below by the numbers, so I'd be able to indicate in the CSV which point belongs to "1", which ones to "2" and so on.

I tried using "multiparts to singleparts". My logic was if I could divide the shape in different parts I could use "extract vertices" on each one of them and retrieve each area points. However, the shape returned remains the same, as one. So I'm not sure what I can do here. Does anyone have an idea?

enter image description here

4
  • 2
    please describe how you used Multipart to Single Part as the polygon should not remain the same
    – Ian Turton
    Feb 28 at 11:52
  • Hi Ian, basically by selecting the function in Vector->Geometry Tools->Multiparts to Singleparts, selecting the polygon in the dropdown list and pressing Run. The output is the same just in another color.
    – Buce1
    Feb 28 at 13:53
  • Well if you colour all the polygons the same colour you will see the same thing. Try selecting one of the polygons
    – Ian Turton
    Feb 28 at 15:33
  • I don't understand what you mean by that, but maybe it has something to do with what I just found out. If I use the Singleparts and then Toggle Editing -> Vertex Tool - Current Layer, I'm able to right click the singular polygons and see the coordinates in a window that opens called "Vertex Editor". From there I can just copy and paste the data somewhere else. Also did some testing with MMQGIS and by exporting the original geometry to CSV the export already divides the data in a column called "partid" which is also great. Thanks for the hint!
    – Buce1
    Feb 28 at 15:48

3 Answers 3

3

As far as I know the "Extract vertices" geoalgorithm creates the "vertex_part_ring" attribute.

1

You can try in the field expression calculator for the verticies:

overlay_nearest('MultiPolygon', $id)[0]

That would add a field with the ID of the polygon to your points / verticies.

enter image description here

0

If you have polygon layer and point layer you can use join attribute by location and make sure you have select intersect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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