# \#polygons

**URL:** https://discourse.julialang.org/tag/polygons/858.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Retrieving CRS from vector and raster data](https://discourse.julialang.org/t/retrieving-crs-from-vector-and-raster-data/107903)

<div class="topic-metadata">

**Author:** [@Bojas](https://discourse.julialang.org/u/Bojas)\
**Replies:** 7\
**Last updated:** [April 1, 2025, 2:15pm UTC](https://discourse.julialang.org/t/retrieving-crs-from-vector-and-raster-data/107903 "2025-04-01T14:15:00Z")

</div>

Hello, I’m new to Julia, as for now I was using mainly Python. What I want to do is to crop part of raster based on polygon. Both polygon and raster are in different spatial references and I have to convert either one of…

---

## [Adding new layer to GeoMakie.jl poly plot](https://discourse.julialang.org/t/adding-new-layer-to-geomakie-jl-poly-plot/122667)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 12:23pm UTC](https://discourse.julialang.org/t/adding-new-layer-to-geomakie-jl-poly-plot/122667 "2024-11-15T12:23:33Z")

</div>

Hi there, I have two sets of Shapefile geometries. If I run: f, a, p = poly(shapefile\_df.polygon; axis = (; type = GeoAxis)) I will get the desired map. However, I would like to add another layer with a different colo…

---

## [Help on changing the color of a poly edge in Makie](https://discourse.julialang.org/t/help-on-changing-the-color-of-a-poly-edge-in-makie/102999)

<div class="topic-metadata">

**Author:** [@marteaua](https://discourse.julialang.org/u/marteaua)\
**Replies:** 0\
**Last updated:** [August 20, 2023, 9:18am UTC](https://discourse.julialang.org/t/help-on-changing-the-color-of-a-poly-edge-in-makie/102999 "2023-08-20T09:18:29Z")

</div>

Hi, I plotted a small 3D mesh using poly in Makie, I use a LScene because I want to put several 3D axis and do camera rotations. I try to change the color of one of the edge of the mesh. My idea is to plot the edge abov…

---

## [Intersection and area of non-convex polygons](https://discourse.julialang.org/t/intersection-and-area-of-non-convex-polygons/101856)

<div class="topic-metadata">

**Author:** [@ferrolho](https://discourse.julialang.org/u/ferrolho)\
**Replies:** 1\
**Last updated:** [July 21, 2023, 6:25am UTC](https://discourse.julialang.org/t/intersection-and-area-of-non-convex-polygons/101856 "2023-07-21T06:25:26Z")

</div>

I am trying to use Julia for visualising instances of the moving sofa problem. I would like to be able to calculate the intersection between non-convex shapes and to also calculate the area of the resulting shapes. Howev…

---

## [Create polygon in LibGEOS.jl](https://discourse.julialang.org/t/create-polygon-in-libgeos-jl/93483)

<div class="topic-metadata">

**Author:** [@SDA](https://discourse.julialang.org/u/SDA)\
**Replies:** 4\
**Last updated:** [January 31, 2023, 7:35pm UTC](https://discourse.julialang.org/t/create-polygon-in-libgeos-jl/93483 "2023-01-31T19:35:39Z")

</div>

I am trying to create a polygon using LibGEOS.jl. The docs give an example for the case where the polygon vertices are input manually: using LibGEOS p1 = readgeom(“POLYGON((0 0,1 0,1 1,0 0))”) I would like to instea…

---

## [Polyhedron of JuMP model with Polyhedra or Lazyset](https://discourse.julialang.org/t/polyhedron-of-jump-model-with-polyhedra-or-lazyset/89218)

<div class="topic-metadata">

**Author:** [@papar](https://discourse.julialang.org/u/papar)\
**Replies:** 7\
**Last updated:** [October 26, 2022, 10:53pm UTC](https://discourse.julialang.org/t/polyhedron-of-jump-model-with-polyhedra-or-lazyset/89218 "2022-10-26T22:53:48Z")

</div>

Hello, I want to plot a 3D polyhedron of a JuMP model for education purposes. I have seen these packages Polyhedra and LazySets, but I am unsure how to convert a JuMP model. I believe it requires projection/elimination.…

---

## [Improving performance on nested for loops (SparseArrays, LibGEOS)](https://discourse.julialang.org/t/improving-performance-on-nested-for-loops-sparsearrays-libgeos/74038)

<div class="topic-metadata">

**Author:** [@nbalasus](https://discourse.julialang.org/u/nbalasus)\
**Replies:** 10\
**Last updated:** [January 7, 2022, 4:41am UTC](https://discourse.julialang.org/t/improving-performance-on-nested-for-loops-sparsearrays-libgeos/74038 "2022-01-07T04:41:15Z")

</div>

I have two arrays of polygons, one with 9,000,000 polygons and the other with 60,000 polygons. I would like to find the intersecting area of each of these. In the MWE example below where I have reduced the example to 201…

---

## [Computational Geometry: Regular Distribution of Points inside of a Polygon](https://discourse.julialang.org/t/computational-geometry-regular-distribution-of-points-inside-of-a-polygon/39523)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 18\
**Last updated:** [December 12, 2021, 1:46pm UTC](https://discourse.julialang.org/t/computational-geometry-regular-distribution-of-points-inside-of-a-polygon/39523 "2021-12-12T13:46:57Z")

</div>

Hello! So I am basically asking since I struggle to figure out if there is an efficient way to do this. Basically I want to be able to take any arbitrary polygon and fill it with particles as shown in this figure: T…

---

## [Why is the intersection of a polyhedra with itself not equal to itself?](https://discourse.julialang.org/t/why-is-the-intersection-of-a-polyhedra-with-itself-not-equal-to-itself/72585)

<div class="topic-metadata">

**Author:** [@XLVII](https://discourse.julialang.org/u/XLVII)\
**Replies:** 7\
**Last updated:** [December 4, 2021, 7:38pm UTC](https://discourse.julialang.org/t/why-is-the-intersection-of-a-polyhedra-with-itself-not-equal-to-itself/72585 "2021-12-04T19:38:42Z")

</div>

using Polyhedra import CDDLib lib = CDDLib.Library() P = polyhedron(vrep(Acolums,Is),lib) #(lines=Acolums , rays = Is) println(intersect(P,P) == P ) # it should be true but it gives false How can it be made to ret…

---

## [How to check if my gridded X and Y are inside a polygon?](https://discourse.julialang.org/t/how-to-check-if-my-gridded-x-and-y-are-inside-a-polygon/70728)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 25\
**Last updated:** [November 3, 2021, 12:52pm UTC](https://discourse.julialang.org/t/how-to-check-if-my-gridded-x-and-y-are-inside-a-polygon/70728 "2021-11-03T12:52:08Z")

</div>

I have gridded X and Y that are defined by lon = 20:0.25:379.75; lat = -90:0.25:89.75; X, Y = ndgrid(lon, lat). My goal is to create a Boolean array (named Index) the same size as X (or Y) and their values should be …

---

## [Polygon area on geoid](https://discourse.julialang.org/t/polygon-area-on-geoid/9107)

<div class="topic-metadata">

**Author:** [@mafla](https://discourse.julialang.org/u/mafla)\
**Replies:** 6\
**Last updated:** [November 1, 2021, 10:42pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107 "2021-11-01T22:42:03Z")

</div>

Hi all, is it possible to estimate the area of a lat-lon-box with Geodesy.jl? Many thanks!

---

## [Color a polygon](https://discourse.julialang.org/t/color-a-polygon/6248)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [November 1, 2021, 3:47pm UTC](https://discourse.julialang.org/t/color-a-polygon/6248 "2021-11-01T15:47:44Z")

</div>

Hi, I have a flat polygon in 3d and I would like to color it. So far, I could not do it. Please note that I do not want to decompose it with triangles. Thank you for your help, Best regards using Plots t=linspace(0,2…

---

## [Find if point is within geojson polygons](https://discourse.julialang.org/t/find-if-point-is-within-geojson-polygons/70416)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 3\
**Last updated:** [October 26, 2021, 10:47pm UTC](https://discourse.julialang.org/t/find-if-point-is-within-geojson-polygons/70416 "2021-10-26T22:47:36Z")

</div>

I am slowly dipping my toe into the Julia waters and I’m hoping someone could point me in the right direction as to how I can determine if a point falls within any of the polygons defined by a geojson file. I’ve found Ge…

---

## [Polygon exterior and interiors](https://discourse.julialang.org/t/polygon-exterior-and-interiors/65190)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 1\
**Last updated:** [July 23, 2021, 5:25pm UTC](https://discourse.julialang.org/t/polygon-exterior-and-interiors/65190 "2021-07-23T17:25:17Z")

</div>

Hi, I’m using Julia’s GeometryBasics package, and in particular the Polygon class. I can create a square polygon by p=Polygon(\[ \[0,0\],\[1,0\],\[1,1\],\[0,1\],\[0,0\] \]) where p.exterior is a 4-element LineString object contain…

---

## [\[Makie\] How to plot a polygon with holes?](https://discourse.julialang.org/t/makie-how-to-plot-a-polygon-with-holes/53565)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 2\
**Last updated:** [January 19, 2021, 12:53am UTC](https://discourse.julialang.org/t/makie-how-to-plot-a-polygon-with-holes/53565 "2021-01-19T00:53:25Z")

</div>

I am trying to plot polygons in Makie.jl, using the poly function. The documentation for that function is quite terse, to say the least. Does anybody have an example on hand of plotting custom polygons, or unions of poly…

---

## [Inpolygon usage](https://discourse.julialang.org/t/inpolygon-usage/39226)

<div class="topic-metadata">

**Author:** [@O\_Julia](https://discourse.julialang.org/u/O_Julia)\
**Replies:** 7\
**Last updated:** [December 24, 2020, 6:15pm UTC](https://discourse.julialang.org/t/inpolygon-usage/39226 "2020-12-24T18:15:59Z")

</div>

How can we generate following Octave codes in Julia with GeometricalPredicates package xv = \[ 0.05840, 0.48375, 0.69356, 1.47478, 1.32158, ... 1.94545, 2.16477, 1.87639, 1.18218, 0.27615, ... 0.05840 \]; …

---

## [Intersection and union of polygons - IoU Metric](https://discourse.julialang.org/t/intersection-and-union-of-polygons-iou-metric/45506)

<div class="topic-metadata">

**Author:** [@maxfreu](https://discourse.julialang.org/u/maxfreu)\
**Replies:** 2\
**Last updated:** [September 22, 2020, 11:47am UTC](https://discourse.julialang.org/t/intersection-and-union-of-polygons-iou-metric/45506 "2020-09-22T11:47:22Z")

</div>

Hi! I would like to compute the intersection over union metric for polygons (concave polygons with holes). Is there a package which implements calculating the intersecting polygon, the union polygon as well as their are…

---

## [How to plot 2D polygons / shapes in Julia and color surfaces?](https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552)

<div class="topic-metadata">

**Author:** [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Replies:** 1\
**Last updated:** [July 5, 2020, 1:51pm UTC](https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552 "2020-07-05T13:51:47Z")

</div>

I have a dataframe that contains the spatial coordinates of polygons as columns x,y, their ID as a column and another column according tho whose values I would like to color the surfaces. Do you have suggestions on how t…

---

## [3D polygons in Plots.jl](https://discourse.julialang.org/t/3d-polygons-in-plots-jl/9761)

<div class="topic-metadata">

**Author:** [@rcnlee](https://discourse.julialang.org/u/rcnlee)\
**Replies:** 4\
**Last updated:** [April 24, 2020, 8:55pm UTC](https://discourse.julialang.org/t/3d-polygons-in-plots-jl/9761 "2020-04-24T20:55:01Z")

</div>

Is there an equivalent to Matlab’s fill3 in Plots.jl to create filled shapes in 3D? I see Plots.Shape, but it looks like it only supports 2D. Thanks!

---

## [Mesh/grid over convex polytope](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 19\
**Last updated:** [March 19, 2020, 10:47am UTC](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047 "2020-03-19T10:47:31Z")

</div>

I have x\_1, \\dots, x\_m points in \\mathbb{R}^n defining a polytope as their convex hull, m \> n. Typically n = 2 or 3 and m = 4 or 5. I would like to make a more or less equispaced (adjusted when necessary) grid \\{ z\_j…

---

## [Draw polygon around scatterplot data?](https://discourse.julialang.org/t/draw-polygon-around-scatterplot-data/28729)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 6\
**Last updated:** [September 16, 2019, 3:29pm UTC](https://discourse.julialang.org/t/draw-polygon-around-scatterplot-data/28729 "2019-09-16T15:29:22Z")

</div>

Is there any package or combination of packages that would let me draw a polygon around a region in scatterplot data? Even just pieces I could cobble something together from. The end goal is to use it to filter my point…

---

## [Creating a polygon of many points in Julia](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687)

<div class="topic-metadata">

**Author:** [@nako95](https://discourse.julialang.org/u/nako95)\
**Replies:** 2\
**Last updated:** [July 6, 2017, 12:36pm UTC](https://discourse.julialang.org/t/creating-a-polygon-of-many-points-in-julia/4687 "2017-07-06T12:36:23Z")

</div>

I want to use something similar to Matlab’s inpolygon function and found this example in Julia: 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)) Th…
