1

I'm currently struggling to calculate the area of a slightly non-planar surface in PostGIS. The area is a wall surface from a LOD2 data source.

Here's an example:

SELECT ST_AsText(ST_DelaunayTriangles(ST_GeomFromewkEWKT('SRID=25832;MULTIPOINT(613595.706 5461088.407 428.479,613595.706 5461088.407 421.196,613598.625 5461091.158 421.196,613601.559 5461093.923 421.196,613601.559 5461093.923 428.452,613598.625 5461091.158 433.68,613595.706 5461088.407 428.479)')));

The result of this query is:

GEOMETRYCOLLECTION EMPTY

Which is unexpected for me.

Based on my understanding of https://postgis.net/docs/ST_DelaunayTriangles.html I would expect ST_DelaunayTriangles() to return a set of triangles.

Is my understanding wrong, is there a problem with my usage or is this a bug?

I'm using PostGIS 3.4.0 with SFCGAL 1.3.8.

3
  • That geometry seems to be vertical and there are no triangles in X-Y plane. PostGIS is not a real 3D program. I edited of the X or Y coordinates and got a couple of triangles SELECT ST_DelaunayTriangles(ST_GeomFromText('MULTIPOINT Z(613595.706 5461088.407 428.479,613595.706 5461088.407 421.196,613598.625 5461091.158 421.196,613601.559 5461093.923 421.196,613601.559 5461093.923 428.452,613598.625 5461191.158 433.68,613595.706 5461088.407 428.479)'))
    – user30184
    Commented Dec 7, 2023 at 13:10
  • Thanks @user30184 for the explanation. If I got you right then ST_DelaunayTriangles requires the triangles to lay in the XY-plane. That's a bummer, but brings me to an idea (will try it out later). If I rotate the wall to lay rougly lay flat delaunay should work and (hopefully) the area calculation will still stay somewhat accurate.
    – Chris
    Commented Dec 8, 2023 at 9:26
  • 1
    So, a not completely generic but for my use-case (vertical surfaces) applicable work-around is to flip the x (or y) and z coordinates, e.g. ST_3darea(ST_DelaunayTriangles(ST_GeomFromText(....))) .
    – Chris
    Commented Dec 8, 2023 at 9:42

0

Your Answer

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

Browse other questions tagged or ask your own question.