3

I'm new to PostGIS and am wondering whether ST_ConvexHull will be of use in a particular work problem. Trying out some simple cases to make sure I understand what it's doing, I didn't expect this:

=> select st_astext(st_convexhull(st_geomfromtext('MULTIPOINT(0 0 0, 1 0 0, 0 1 0, 1 1 0, 0 0 1, 1 0 1, 0 1 1, 1 1 1)')));                                                                        
st_astext
---------------------------------------------
 POLYGON Z ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))
(1 row)

I think I'm asking for the convex hull of the vertices of the unit cube, which should also be the unit cube. Have I messed up the query, or my interpretation of the result, or my understanding of convex hulls, or something in my PostGIS setup?

PostGIS 2.1.1, PostgreSQL 9.3.4.

  • 3
    Function is implementing portal.opengeospatial.org/files/?artifact_id=13228 which says that "simple features are based on 2D geometry with linear interpolation between vertices". Therefore you will get a flat polygon as a result. You wish to get a volume, or? – user30184 Aug 19 '14 at 7:24
  • Thanks. I interpreted ["[ST_ConvexHull] supports 3d and will not drop the z-index."](postgis.net/docs/ST_ConvexHull.html) to mean that I'd get some polyhedral hull, which per your link to the spec is incorrect. I guess it uses an (x,y,z) vertex from the input where its (x,y) is a vertex of the 2d hull it calculates. – Richard Barnett Aug 25 '14 at 3:48
  • @user30184 If you convert that comment to a reply I'll accept it. – Richard Barnett Aug 25 '14 at 3:49
1

The ST_ConvexHull function is implementing the Simple Features specification portal.opengeospatial.org/files/?artifact_id=13228 which says that "simple features are based on 2D geometry with linear interpolation between vertices". Therefore you get a flat polygon as a result.

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.