# ArchGDAL Convexhull not return a polygon

**URL:** https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609
**Category:** General Usage
**Tags:** question, package, gmt, gdal, convex-hull
**Created:** [February 1, 2022, 11:03pm UTC](https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609 "2022-02-01T23:03:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ZWJZ9](https://avatars.discourse-cdn.com/v4/letter/z/aca169/32.png) [@ZWJZ9](https://discourse.julialang.org/u/ZWJZ9)
#### Post date: [February 1, 2022, 11:03pm UTC](https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609/1 "2022-02-01T23:03:48Z")

</div>

Hello Everyone,

I am new to julia and currently using ArchGDAL. Currently, I want to compute a convex hull for a lot of points. When I using AG.convexhull, and save the result to a shapefile using GeoDataFrames. When I open the shapefile with QGIS, the shapefile is still the orignal points. The result should be a convexhull polygon (only one polygon).

Here is the code:

coords = zip(rand(10), rand(10))  
points=AG.createpoint.(coords)  
hull=AG.convexhull(points)  
table = DataFrame(geom = hull)  
GDF.write(“hull.shp”, table)

Also, does anyone know how to read shapefile(points) and compute convex hull for shapefile directly?

Any help on this? Thanks in advance!

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [February 2, 2022, 12:35am UTC](https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609/2 "2022-02-02T00:35:52Z")

</div>

You can do it with GMT

```julia
using GMT

pts = rand(10,2);                                         
c = convexhull(pts, gdataset=true); # gdataset option is optional but here avoids unnecessary conversions      
gdalwrite(c, "lixo.shp") # Save it as a shape

# Confirm 
imshow(gmtread("lixo.shp"), plot=(data=pts, marker=:star))

```

 ![GMTjl_tmp](https://global.discourse-cdn.com/julialang/original/3X/6/4/64ffad41b8925f13a8bad4eeeaf50649aa7b063f.png)
