# Cast Polygon to Multipolygon with ArchGDAL.jl

**URL:** <https://discourse.julialang.org/t/cast-polygon-to-multipolygon-with-archgdal-jl/110592>\
**Category:** General Usage\
**Tags:** plotting, geo, geometry\
**Created:** [February 22, 2024, 4:30pm UTC](https://discourse.julialang.org/t/cast-polygon-to-multipolygon-with-archgdal-jl/110592 "2024-02-22T16:30:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)\
**Post date:** [February 22, 2024, 4:30pm UTC](https://discourse.julialang.org/t/cast-polygon-to-multipolygon-with-archgdal-jl/110592/1 "2024-02-22T16:30:48Z")

</div>

I have a `Vector{IGeometry{wkbMultiPolygon}}` which I need to simplify for plotting.  
However, doing `ArchGDAL.simplify.(geoms, 0.001)` results in some `wkbMultiPolygon`s becoming `wkbPolygon`s and Makie is not happy about the heterogeneous eltype of the container. Can I somehow cast the simple Polygons to MultiPolygons? Or is there a generally better way to do this?

---

<div class="post-metadata">

**Author:** ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)\
**Post date:** [February 22, 2024, 8:20pm UTC](https://discourse.julialang.org/t/cast-polygon-to-multipolygon-with-archgdal-jl/110592/2 "2024-02-22T20:20:28Z")

</div>

I believe you can use [ArchGDAL.forceto](https://yeesian.com/ArchGDAL.jl/stable/reference/#ArchGDAL.forceto) to convert to multi polygon.

---

<div class="post-metadata">

**Author:** ![Jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jakob](https://discourse.julialang.org/u/Jakob)\
**Post date:** [February 23, 2024, 8:32am UTC](https://discourse.julialang.org/t/cast-polygon-to-multipolygon-with-archgdal-jl/110592/3 "2024-02-23T08:32:31Z")

</div>

Perfect, that did the trick!
