3

I have polygon layer and i need to find (select, so i can export selected to new layer) all the vertices that are in provided distance to each other (like 2 meters).

I already tried:
1. Export polygon to point (Extract Node)
2. Run delete duplicates (as the extract node creates duplicates).
3. Create distance matrix (this one is problematic as it shows distance in datasource units which is dd and i want it to be meters)
4. Join tables and then filter them using distance < value

Is there a better way to achieve this, like a tool?

0

1 Answer 1

1

Might I suggest:

Right click on the layer and select Save As.. then specify a projected coordinate system to do your calculations in.

Convert polygon/line vertices to points instead of Extract Nodes. The first field (ID) is a backslash delimited field with sourceID/part/vertex to allow you to track back.

Delete your duplicates if necessary.

Add coordinates to points on the vertices to allow for easier calculation. I opened the dbf in Excel and used the distance formula:

=SQRT(( G3-G2)*(G3-G2) + (H3-H2)*(H3-H2))

Which is simple Pythagorean maths.

Expanded to new polygons:

=IF(LEFT(A2,FIND("/",A2))=LEFT(A3,FIND("/",A3)),SQRT((G3-G2)*(G3-G2)+(H3-H2)*(H3-H2)),"New")

Which puts in 'New' when the next vertex isn't the same polygon otherwise the difference. Then using:

=IF(I2 <> 0, IF(I2<2,LEFT(A2,FIND("/",A2)-1),"-1"),-2)

I can find the ID of the polygon that contains short segments, in this case if the distance is 0 (same) then the value is -2, if it's a new polygon or the distance is greater it's -1 and for short segments it's the ID of the polygon.

Then save that to a CSV file (do not save the DBF) and you can reference all the polygons and locations where you have a short segment.

You could achieve similar results using the field calculator in QGIS but I used Excel because it's easier to get to the next row.

5
  • It seems complicated. How do you calculate distance between last point of polygon with first? I think to make this work we cannot delete duplicates.
    – gisit
    Commented Dec 5, 2014 at 23:03
  • 1
    Something similar can be achievied with 1. Polygon to line, 2. Explode lines, 3.filter query --> select all the lines with length < param
    – gisit
    Commented Dec 5, 2014 at 23:14
  • @gisit Your point 2. Explode Lines, is there a way you know of to convert polylines into two-point lines? The question is in regard to segments (section between two consecutive vertices) not short parts, unless I completely misunderstood the question. Commented Dec 7, 2014 at 22:20
  • Explode lines does convert line segments into separate lines (2-point lines), doesnt it? If yes exploding and calculating length of the lines will be similar to your answer. The question was not in regard to line segments but distance between vertices (not necessary consecutive).
    – gisit
    Commented Dec 7, 2014 at 23:51
  • Doh! Perhaps a picture showing good & bad examples would help. Commented Dec 7, 2014 at 23:52

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.