I have thousands of 3D polygons scattered in space but they mostly overlap with many of their neighbors in big extent.

Is there any way how to compute volume they define effectively?

I would love to have precise volume, but some relatively good approximation will do too.

My solutions so far:

  1. v.patch() (GRASS) - so far, I was able to just patch faces and kernels, but it does not form closed 3D polygon after looong computation.

  2. ST_3DUnion() (PostGIS) - unfortunately, the function is not an aggregate function (it accepts only two simple arguments). I have wrote function calling ST_3DUnion iteratively, unioning polygons one by one. But obviously, computation is slow and basically stops on polygon 100.

  3. Substracting polygons from master volume (PostGIS) - creating one big polygon from bbox of all my polygons and then using ST_3DDifference while iteratively substracting every single polygon. What I am left with is big polygon with a hole with volume of my interest. Never tried - probably same issue as 2).

  4. Overlap with 3D point grid (PostGIS) - I could create 3D points not far away each other in such way they form regular grid which covers bbox of all polygons. Finally, I would create spatial index on this layer and count points falling inside any polygon (operator &&& and ST_3DIntersects() could help a lot) but it is extremely memory demanding and gives "only" estimation of the volume. This is like rasterization by 3D raster.

Obviously 1), 2) and 3) are suffering from exponential increase of faces/points after processing several polygons. Maybe, there is a way which does not require so expensive operations? Especially when I am interested only in volume.

Just to explain, I am trying to implement relatively simple Local Convex Hull algorithm in 3D. I have solved 3D hulling in GRASS (see my previous question) since ST_ConvexHull() does not work in 3D.

  • Could you please elaborate? Did you mean using ST_3DIntersection on bounding master polygon and inner polygons? Firstly, the function returns solid but not closed object therefore ST_Volume() will fail (tested on the last example from man page). Also, the function can't handle multiple object at once. I have tried to feed it with my polygons as a collection. It returns TIN so again, no volume.
    – vildead
    Commented Apr 27, 2019 at 22:15
  • Interesting question and I feel you pain having worked with the 3D functions quite a bit, and, also, the MySQL version of ST_Union, which is also not an aggregate function. If you are trying to calculate a local convex hull (which appears to operate in 2 dimensions), can you not project the extents of your volumes onto a 2D surface and perform the local convex hull on that? Commented Apr 29, 2019 at 10:44
  • @JohnPowell: Just to clarify, I already did compute 3D convex hulls. Those are my 3D polygons. Now I need to know how big volume they cover all together. Btw, did you mean projecting on XY, YZ, and XZ, getting points which form 2D convex hull in each of these orthogonal "projections" and use only them to create approximate 3D hulls? Nice thought...
    – vildead
    Commented Apr 30, 2019 at 7:23
  • 2
    You could try 3d meshing programs such as Blender or Meshlab. Here's an example on creating a watertight model with Meshlab - instructables.com/…. Also look into this workflow using CloudCompare - danielgm.net/cc/forum/viewtopic.php?p=24557 Commented Nov 17, 2022 at 14:34
  • If you got as far as creating a TIN, and your TIN does form a closed surface, you can force it to be a volumetric using - postgis.net/docs/manual-3.4/en/ST_MakeSolid.html and then apply ST_Volume
    – Regina Obe
    Commented Dec 27, 2023 at 4:54

1 Answer 1


Assuming the 3D objects have a standard z-value and are not irregular in height you could create a layer that is a footprint/simple polygons of the objects. You could then perform a simple intersect operation, leaving you with just the intersecting polygon(s). On the remaining geometries you can exclude by their height, given that there is a z-value field present. Following this you can use a tool similar to ESRI's "Add Z Information" to add a field that automatically calculates the volume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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