-1

This question already has an answer here:

I have a geojson file with a lot of features. Many of them look like that: Feature

What I'd like to get is a shape that very much resembles this one but is smoothed a little bit. Ideally, it would look similar to that one:

result

Do you have any ideas how to do this? I tried using GRASS in QGIS (generalize function) but I wasn't able to find parameters that would yield satisfactory results.

I used all of the algorithims available in GRASS v.generalize method using different parameters.

This is the GEOJson:

{
"type": "FeatureCollection",
"name": "shape",
"crs": { "type": "name", "properties": { "name": 
"urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": 
"Polygon", "coordinates": [ [ [ 70.297311693548977, 15.511449157884835 
], [ 70.297311693548977, 15.511457528420548 ], [ 70.297088479263266, 
15.511496590920549 ], [ 70.297094059620406, 15.511552394491977 ], [ 
70.297253099798979, 15.51153565342055 ], [ 70.297264260513259, 
15.511597037349121 ], [ 70.297311693548977, 15.511591456991978 ], [ 
70.297311693548977, 15.511588666813408 ], [ 70.297353546227555, 
15.511588666813408 ], [ 70.297353546227555, 15.511449157884835 ], [ 
70.297311693548977, 15.511449157884835 ] ] ] } }
]
}

The most sensible soultion out of those included in v.generalize was to use chaiken method with small "Maximal tolerance value" parameter, but it was also not very good:

chaiken

marked as duplicate by aldo_tapia, BERA, whyzar, BBG_GIS, HDunn Nov 15 '17 at 20:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The solutions listed there dint't yield a satisfactory result. – mihal277 Nov 15 '17 at 14:00
  • 1
    It would probably be helpful to show how you configured the tool, and explain why it wasn't satisfactory. – RoperMaps Nov 15 '17 at 14:06
  • Edited, I hope now it tells the story – mihal277 Nov 15 '17 at 14:53
  • 1
    I fear what you want to do will be hard to set as it is. Try to think of a quantified criteria to erase a point and not another one. Smoothing generally gives you a rounded polygon. – gisnside Nov 15 '17 at 16:08
  • 1
    Did you try a simplifying algorithm? Chaiken is a smoothing algorithm which is not the same. @lynxlynxlynx highlights the potential pitfall of simplifying which is thin polygons. – RoperMaps Nov 15 '17 at 16:53
1

I think you'd have to code this yourself, but I fear there is no way to always do it accurately. The chosen parameter(s) will just be off for some cases.

Two approaches come to mind:

  • traversing the edges and deciding what to do at vertices depending on the running length and angle changes. Modify the geometry if they are small enough;
  • computing the distance of consecutive vertices and if it is small enough, merging one into the other. For your example, maximising area would work as a way to decide which point to remove. This one is vulnerable to polygons thinner than the threshold though!
1

You could try "square" buffering your layer by X distance (you'll have to try depending on your data) then by -X distance. It might be sufficient to remove little parts.

For that, you may be interested by the GRASS algorithm v.buffer with snap distance options activated. See Creating square buffer in qgis

I'll do some more tries to seek the best method to avoid round borders (the problem with my example below), but the main trick is to use a square buffer method.

Buffer in and out

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