# Creating a polygon of many points in Julia

**URL:** https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687
**Category:** New to Julia
**Tags:** polygons
**Created:** [July 6, 2017, 12:15pm UTC](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687 "2017-07-06T12:15:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nako95](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@nako95](https://discourse.julialang.org/u/nako95)
#### Post date: [July 6, 2017, 12:15pm UTC](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687/1 "2017-07-06T12:15:10Z")

</div>

I want to use something similar to Matlab’s inpolygon function and found this example in Julia:

```nohighlight
lr = Point(1.2,1.0)
ur = Point(1.2,1.2)
ul = Point(1.0,1.2)
poly = Polygon(ll, lr, ur)
inpolygon(poly, Point(1.1,1.1)) 

```

This seems like exactly what I need but I need to add around 50 points so it’s not possible to add them manually as in this example. I tried to create the polygon by adding the points as a vector (in that case I could create an array of my points with a loop). This is what I tried:

```julia
r=[lr,ur,ul]
poly=Polygon(r)

```

but I got an error message, Polygon can apparently not accept an array of points. How do I create a polygon with many points in Julia?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [July 6, 2017, 12:27pm UTC](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687/2 "2017-07-06T12:27:54Z")

</div>

Try

```julia
Polygon(r...)

```

PS: Making your example self-contained would be helpful. Otherwise, we have to guess that you are `using GeometricalPredicates`.

---

<div class="post-metadata">

### Author: ![nako95](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@nako95](https://discourse.julialang.org/u/nako95)
#### Post date: [July 6, 2017, 12:36pm UTC](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687/3 "2017-07-06T12:36:23Z")

</div>

Thank you, it worked!  
Of course, I’ll do that next time!
