# Lines -\> Polylines -\> Polygons

**URL:** https://discourse.vtk.org/t/lines-polylines-polygons/2759
**Category:** Support
**Created:** [March 5, 2020, 8:11am UTC](https://discourse.vtk.org/t/lines-polylines-polygons/2759 "2020-03-05T08:11:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cobo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.vtk.org/u/cobo)
#### Post date: [March 5, 2020, 8:11am UTC](https://discourse.vtk.org/t/lines-polylines-polygons/2759/1 "2020-03-05T08:11:51Z")

</div>

Maybe this is just a naming question, but what I want to achieve is:

- Read some linear data that are either already polylines, but maybe also just line segments with common end points that need to be joined first.

- Convert the polylines to polygons - just ignoring the possibility that start and end point may not coincide (meaning that a line segment would be inserted implicitly)

I know that the opposit functionality, i.e. cutting polyline into line segments, or “higher grade surfaces” into triangles etc. is done with the “vtkTriangulate” filter - which is also not a case of “intuitive naming”, but very handy if you need such operations! So I am asking whether such things already exist.

If not I see not a big problem writing such a filter myself, but why reinvent wheels?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [March 5, 2020, 1:55pm UTC](https://discourse.vtk.org/t/lines-polylines-polygons/2759/2 "2020-03-05T13:55:40Z")

</div>

> [@cobo](#):
>
> Read some linear data that are either already polylines, but maybe also just line segments with common end points that need to be joined first.

`vtkStripper` with the `JoinContiguousSegments` flag set to on should do this.

> [@cobo](#):
>
> Convert the polylines to polygons - just ignoring the possibility that start and end point may not coincide (meaning that a line segment would be inserted implicitly)

Try `vtkContourTriangulator`.

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.vtk.org/u/cobo)
#### Post date: [March 5, 2020, 2:11pm UTC](https://discourse.vtk.org/t/lines-polylines-polygons/2759/3 "2020-03-05T14:11:06Z")

</div>

Many thanks: looks promising!
