9

I'm trying to simplify a polygon using the interior angle of a vertex as the "tolerance" instead of the distance between vertexes. For e.g. the polygon in the image below would lose one vertex, because of its large internal angle. As an example, I might want to remove all vertexes with an internal angle greater than 170°.

polygon

Taras
  • 32,823
  • 4
  • 66
  • 137
Alec McKay
  • 93
  • 5

5 Answers5

6

Initial data: a pentagon (polygon1).

Output: a simplified quadrilateral.

The process is shown in the gif below in Figure 1.

enter image description here

The sequence of operations from bottom to top is shown in figure 2,

enter image description here

9) Vector->Processing geometry->Combine by feature...
8) Vector->Processing geometry->Delaunay triangulation...
7) Vector->Processing->Intersect...
6) Data Analysis->Analysis Tools->Vector Geometry->Blow Lines...
5) Vector->Processing geometry->Convert polygons into lines...
4) Vector->Process Geometry->Voronoi Polygons...
3) Vector->Processing geometry->Extract vertices...
2) Vector->Processing geometry->Centroids...
1) Source data.

Save the result...

and don't forget to add the centroid to the vertices in the sequence of actions :-)...

option 2

Input data: set of single-type polygons of pentagon-envelope type.

Output data: simplified polygons of the quadrangle type.

The process is shown in Figure 3 below enter image description here

The sequence of operations is shown in Figure 4 from bottom to top.

enter image description here

7) Vector->Processing geometry->Convert lines to polygons...
6) Data analysis->Analysis tools->Create vector objects->Points to path
5) Data Analysis->Analytical Tools->Vector - Select->Extract by Spatial Position
4) Data Analysis->Analysis Tools->Vector Geometry->Rotate
3) Data Analysis->Analysis Tools->Vector Geometry->Oriented minimum bounding box...
2) Vector->Processing geometry->Extract vertices...
1) Source data.

Important: when extracting by spatial position (5), activate the "disjoint" checkbox...

Original solutions...

Translated with www.DeepL.com/Translator (free version)

Cyril Mikhalchenko
  • 4,397
  • 7
  • 14
  • 45
  • 2
    Thanks for your answer but "use the translation yourself" is just not a useful contribution. How are users without kyrillic keyboards even supposed to do that? Please add explanations of the steps in English on this English community website. :) – bugmenot123 May 24 '21 at 10:32
  • @bugmenot123, by the way, does QGIS have the ability to automatically translate tool names and definitions from one language to another on the fly, for example in "properties->" or in the common tools panel? – Cyril Mikhalchenko May 24 '21 at 18:10
  • I'm sorry, I don't really understand how this solution works and can't reproduce it, information is still too scarce and moving gifs don't help a lot to understand without further information. I'm not sure if this workflow really works for what was asked - obviously, in the case of convex pentagons, it produces something that looks as what the OP asked for: remove vertices with interior angle > 170. But not sure how precise it works. – Babel May 24 '21 at 18:55
  • I have several questions: 1) option 1: how you come from step 7 to step 8? step 7 gets you lines, how you can use these for Delaunay? 2) How accurate is this solution for different kind of polygon shapes? Does it work for pentagons only? 3) Solution 2: why etracting vertices? step 4: rotate... by what? I'm not really able to reproduce that solution, either. – Babel May 24 '21 at 18:56
  • @Babel, So 1) for me, step 7 gives points, not lines; 2) OP presented a pentagon envelope in his drawing and my suggestions were designed for such figures; 3) Vertices are necessary to get rid of an unnecessary vertex later on; 4) You rotate the oriented polygon by 90 degrees to remove an unnecessary vertex 5) I wish you could reproduce the example, maybe I should think about more detail in the solution, though. ..

    Translated with www.DeepL.com/Translator (free version)

    – Cyril Mikhalchenko May 24 '21 at 19:06
  • 1
    OK, in that case it means that I probably didn't understand step 6: can't find Menu Data Analysis->Analysis Tools...? Blow lines - you mean explode lines - this here: https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html?highlight=explode#explode-lines ? Than you get lines, if you intersect them with the polygon (step 7), you still have lines. How could you use Dealaunay on this? – Babel May 24 '21 at 19:17
  • Remember that I work with autotranslation; 2) The tool does this -This algorithm takes a lines layer and creates a new one in which each line is replaced by a set of lines representing the segments in the original line. Each line in the resulting layer contains only a start and an end point, with no intermediate nodes between them.
  • If the input layer consists of CircularStrings or CompoundCurves, the output layer will be of the same type and contain only single curve segments. 3) Data Analysis->Toolbar...

    – Cyril Mikhalchenko May 24 '21 at 19:22
  • Explode lines select the necessary points...Try not to complicate the processes, but rather simplify them... – Cyril Mikhalchenko May 24 '21 at 19:32
  • 1
    OK, I got your option 2 solution to work. It seems to be reliable for the kind of shape asked for (pentagon), but not for all kind of shapes. @Alec McKay: you did not state if you only have this kind of shapes or others as well? – Babel May 24 '21 at 19:36
  • There may be 3, 4, 5, etc., and judging by the picture we are talking about a pentagon, although we can be wrong, which is why I ask OP to provide the original geodata in the form of a link to them! By the way, my first option, can do just fine without voronoi Diagrams and Triangle Delone, but I didn't understand to the end whether we are really only talking about pentagons :-)... – Cyril Mikhalchenko May 24 '21 at 19:39