Convex Hull

A convex hull of a shape is defined as:

In mathematics, the convex hull or convex envelope for a set of points X in a real vector space V is the minimal convex set containing X (Wikipedia)

Wikipedia visualizes it nicely using a rubber band analogy, and there are some good algorithms to compute it.

Concave Hull

A concave hull is visualized using the red line in the image below (the blue line visualizes the convex hull). Intuitively, it is a polygon which embraces all the points, but has less (minimal?) area compared to the convex hull. As a result, the polygon's boundary length is longer.

A concave hull may be the solution for some real-world problems (e.g. finding the reasonable boundary of a city).

enter image description here

I have failed to find a proper definition, algorithm and practical solution for the notion of a Concave Hull. The Grass Wiki has some descriptions and images, and there is a commercial solution in concavehull.com.

Any ideas, algorithms and links?

  • In what context to you want to generate concave hulls/alpha shapes? In PostGIS, ArcMap, a web-map, your own software?
    – fmark
    Aug 17, 2010 at 0:39
  • Both PostGIS and my own Python scripts.
    – Adam Matan
    Aug 17, 2010 at 5:29
  • Is there a C++ Linux-compatible version of implementation of the concave hull algorithm ?
    – Sylv255
    May 31, 2018 at 16:24
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review May 31, 2018 at 17:35
  • Computational Geometry Algorithms Library (CGAL) is a C++ library with Alpha Shapes. It has a Linux download and is licensed as GPL/LGPL for version >=4.0.
    – klewis
    May 31, 2018 at 18:07

14 Answers 14


As scw points out, you want an implementation of α-shapes.

Alpha shapes can be considered a generalisation of the convex hull. They were first described in 1981 in:

Edelsbrunner, H.; Kirkpatrick, D.; Seidel, R.; , "On the shape of a set of points in the plane," Information Theory, IEEE Transactions on , vol.29, no.4, pp. 551- 559, Jul 1983

Open source implementations exist for the environments you are interested in:


If you are using the PostGIS stack, pgRouting's optional Driving Distance extension exposes an alpha shape implementation. I'm not sure if you can vary the alpha parameter, however.

Usage is below:

SELECT the_geom AS alpha_shape 
    'SELECT id, ST_X(your_geom) AS x, ST_Y(your_geom) AS y FROM your_table');


There are probably many Python modules you could use. I have heard good things about CGAL, a C++ computational geometry library. Python wrappers exist for parts of CGAL, including exposing CGAL's alpha shape implementation to Python.

Be aware that parts of CGAL are licensed under the QPL, which means that if you distribute your program, linked to CGAL, you may need to release it under the QPL. It is fine to keep your code proprietary if you do not redistribute your program code or binaries.

  • I can't get the python wrappers of CGAL to compile---it seems that these haven't been supported in a while and no longer work with a recent version of CGAL.
    – conradlee
    Jul 24, 2011 at 22:16
  • 2
    @fmark: Second link you posted seems to be dead.
    – radek
    Dec 6, 2011 at 14:32
  • 1
    @fmark PostGIS links seem to be dead..
    – radek
    Jun 11, 2015 at 13:08
  • The α-shapes link is dead. That webpage does not exist anymore. One prefix of the original hyperlink target is www.cs.duke.edu/~edels. That prefix URL is also dead. May 12, 2021 at 0:40

Here is what you are looking for.

You can download and test the program: (in java, under GPL license)

alt text

The paper presenting the algorithm is there:

Duckham, M., Kulik, L., Worboys, M.F., Galton, A. (2008) Efficient generation of simple polygons for characterizing the shape of a set of points in the plane. Pattern Recognition v41, 3224-3236

  • 3
    The paper feels quite funny to me. It is alpha shapes with one added constraint (result must be a simple polygon). Instead of saying this sentence, the algorithm is described newly from the beginning.
    – emu
    Apr 29, 2020 at 12:41

This seems to be a specific application of alpha shapes, which are from my reading a more general form of this problem. R has the alphahull module, which has excellent documentation on computing alpha shapes. Also check this detailed background on alpha shapes. If you only want to compute convex/concave hulls, check out lasboundary, part of lastools, it scales well and can handle millions of input points.

Finally, this interesting application of alpha shapes by Flickr made the rounds a while ago, showing their utility for aggregating user generated point content:

alpha hull of texas from flickr

  • 1
    OMG the source is written in FORTRAN :-)
    – Adam Matan
    Aug 16, 2010 at 7:51
  • There's the clustr package written in C++ if that suits you better; but be careful with the licensing on CGAL: github.com/straup/Clustr
    – scw
    Aug 16, 2010 at 8:11
  • 2
    Nice real-world example.
    – DavidF
    Aug 16, 2010 at 13:23

There is an implementation of ST_ConcaveHull in PostGIS trunk. http://postgis.net/docs/ST_ConcaveHull.html

  • 1
    I think this first appears in Version 2.0 of PostGis
    – Adrian
    Aug 14, 2011 at 14:42
  • Fantastic! Very nice to have it as an integral part of PostGIS.
    – Adam Matan
    May 10, 2022 at 14:26

I created a highly-efficient tool, called lasboundary (1,2), that computes a concave hull for LIDAR in LAS/LAZ/SHP/ASCII format and stores the result as a vector boundary polygon in ESRI Shapefile format or a geo-referenced KML file.

Here is an example run:

C:\lastools\bin>lasboundary -i SerpentMound.las -o SerpentMound_boundary.shp
reading 3265110 points and computing convex hull for 3265110 points
growing inward towards concave hull (with concavity = 50)
outputting the concave hull
concave hull has 1639 points

Some result pictures are here.


Here is an R function that implements the Alpha Hull model. The output is an sp polygon object. Please see the example in the header. It requires the sp, alphahull and maptools packages.

**Update (01-15-2018) There have been numerous changes to the resulting objects produced by the alphahull package. As such, I needed to rewrite the function. I added a convexHull function to the spatialEco package. However, due to licensing restrictions in the alphahull package this function is only available in the development version on GitHub. The development version can be installed using:


Here is an example of the functions usage

 coordinates(meuse) = ~x+y
a <- convexHull(meuse, alpha=100000)
    points(meuse, pch=19)

Convert the resulting SpatialLinesDataFrame to SpatialPolygonsDataFrame

a <- sf::st_as_sf(a) 
a <- sf::st_polygonize(a)
class( a <- as(a, "Spatial") )

Test multiple alpha values

   for (a in c(500, 1500, 5000, 100000)) {
   ch <- convexHull(meuse, alpha = a)
      points(meuse, pch=19)
        title( paste0("alpha=", a))      

various ahull alpha parameter(s)

  • +1 Could you explain how this differs from the alpha shapes package?
    – whuber
    Aug 14, 2012 at 19:07
  • 3
    The output of alphahull object is stored as a matrix and must be coerced to a usable sp object. I would consider this a "helper" function to create a polygon that can be exported to a GIS format. This function uses the alphahull package to create the hull matrix object, creates an sp object and then explodes the polygon slot so it is a single-part polygon dataframe object. Nothing is showing up in the package help but there may be newly implemented native coercion to an sp class object that I am not aware of. If this is the case please let me know so I can decommission this function. Aug 14, 2012 at 21:13
  • What's the programming language?
    – Adam Matan
    Aug 15, 2012 at 8:07
  • Thanks @JeffreyEvans I've managed to get this working. Could you possibly explain the parameters? I've had a look at the linked jstatsoft paper, but it's pretty impenetrable.
    – geotheory
    Dec 20, 2016 at 12:30

About R implementation Alpha-Shapes, there's an article about "Converting Alpha-Shapes into SP Objects"

It's based on alphahull, sp and spgrass6 http://casoilresource.lawr.ucdavis.edu/drupal/node/919


JTS (https://github.com/locationtech/jts) provides a Convex Hull implementation. Martin Davies also mentioned having an Alpha Shape algorithm in the works so you might want to check the SVN repository to see if it is in yet if that's what you want.

  • Still no concave hull/alpha shapes implementation as of June 2012 as far as I can tell.
    – blah238
    Jun 5, 2012 at 5:54
  • Still nothing in May 2013. May 1, 2013 at 17:42
  • Is JTS alive? Last version is from Dec 19, 2006. vividsolutions.com/jts/JTSHome.htm Aug 25, 2013 at 21:57
  • try the link in the answer
    – Ian Turton
    Aug 26, 2013 at 17:24
  • JTS is now on Github, and is approach version 1.15: github.com/locationtech/jts Although as far as I can tell, there still doesn't seem to be an Alpha Shapes implementation. Mar 25, 2017 at 2:26

Speaking about JTS, you can use Geoscript for manipulating JTS library. http://geoscriptblog.blogspot.com/2010/06/unwrapped-jts-with-python.html for an article about convex hull. GeoScript implementations are available in JavaScript, Python, Scala, and Groovy. The official website : http://geoscript.org


Here's a program written in C that computes convex hulls, alpha shapes, Delauney triangluations and Voronoi volumes:

  • Hull - Ken Clarkson (2002)

Another convex hull algorithm with C and Java implementations is here:


To add to previous answers for this post, at least as of QGIS 2.6 does have concave hull algorithm

Input point layer [vector: point]
put parameter description here

Threshold (0-1, where 1 is equivalent with Convex Hull) [number]
put parameter description here
Default: 0.3

Allow holes [boolean]
put parameter description here
Default: True

Split multipart geometry into singleparts geometries [boolean]
Default: False

Outputs Concave hull [vector]
put output description here

Console usage
processing.runalg('qgis:concavehull', input, alpha, holes, no_multigeometry, output)

Also, Esri has a tool Minimum Bounding Geometry (Data Management)

Which allows you to choose the geometry type, which includes convex hull

enter image description here


There is a new Addon for GRASS GIS 7 available: v.concave.hull. See also http://grasswiki.osgeo.org/wiki/Create_concave_hull


To help with the "proper definition" part of your question; you may have looked at https://en.wikipedia.org/wiki/Convex_hull and gotten what could well be considered a "proper" definition, but found it lacking, so perhaps a more "useful" definition is:

For every point inside a convex hull, a straight line to any point not within the hull will only intersect the hull once.

This is useful because given a point you can construct a line through it and test for that constructed line intersecting segments of the hull.

  • No intersection the point is not in the hull.
  • One intersection the point is on the hull.
  • Two intersections the point is within the hull
  • A straight line cannot intersect a convex hull more than twice
  • 3
    the op is asking about concave hulls, and not convex hulls
    – winwaed
    Jun 29, 2015 at 2:31

JTS now has a Concave Hull implementation. This is based on erosion of the Delaunay triangulation of the input points. It supports creating holes, and provides both absolute and scale-free length parameters.

The algorithm has also been ported to GEOS, and exposed in the next version (3.3) of PostGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.