# Removing narrow polygon dangles?

Using QGIS v 3.4.4.

I have a polygon layer in which some shapes have a very narrow extension that i would like to remove. Unless zoomed in these extensions appear as dangles but when zoomed right in you can see that they are part of the polygon shape. I have tried the v.clean toolset without success and snap geometries to layer which ends up crashing the project. I can manually edit the shape to correct but I don't know how many or where these occur in the layer.

Nice geometric exercise:

1. Compute vertices of original polygons, keep polygon ID,
2. Compute small negative buffers of original polygons,
3. Compute distances of vertices to corresponding negative buffer (scripting required) unless polygons are far away from each other,
4. Express distances in terms of standard deviation for individual groups,

Results shown in the picture below:

I would visit every point with distance greater than 3 deviations and delete ones that looks like artefact. Remaining point can be converted back to polygons, because they are ordered and store polygon ID. Alternative is manual editing, because automatic technique won't work for donuts.

For 'inside' needle use positive buffer in step 2).

I tested workflow below in ArcGis, see if you can find same tools in QGIS, which is very likely.

In the past I have used the algorithm given by Gaspare Sganga's PostGIS normalization page.

The despiking step is:

The function analyzes all the adjacent points in the input geometry in groups of three. Now imagine a triangle is drawn connecting those three points. The central point of a group is removed in one of the following cases:

1. The area of the triangle is smaller than PAR_area_threshold and the angle corresponding to the central point is smaller than PAR_angle_threshold.

2. The area of the triangle is smaller than PAR_area_threshold and the angle corresponding to the first or the last point is smaller than PAR_angle_threshold while the distance between the other two points is smaller than PAR_point_distance_threshold.

3. The area of the triangle is smaller than PAR_null_area, regardless of the angles.

Your task is successfully solved in QGIS using the buffer tool (playing with negative and positive values),

See the initial screenshot with a spike in Figure 1.

1) Run the tool on the Menu bar Vector> Geoprocessing> Buffer and set the negative buffer, so so that it is guaranteed to eat all your spikes, based on their maximum width, see screenshot 2.

2) Then repeat the steps on the virtual buffer, for which set positive buffer values ​​as shown in screenshot 3,

see the result in screenshot 4,

save it and good luck ... :-),

• This will create polygon with a lot of unnecessary verticees. Original vertices on sharp corners will move deep inside original polygon. – FelixIP Mar 30 '19 at 19:14
• FelixIP, Of course, everything depends on the operation of the algorithm itself and its correct settings in QGIS 3.4. I did not develop it, and nevertheless it is able to solve this problem, perhaps with a slight simplification of the true shape ... – Cyril Mar 30 '19 at 19:46
• It is what I'd call cartographic solution, though that spike won't be visible at small scale anyway. It replaces few vertices polygon by completely different shape. If shape in question shares edge with other polygon, the whole topology will be ruined. 2 other solution below designed to minimize that damage. – FelixIP Mar 30 '19 at 20:48