5

I am trying to calculate the volume of a multipolygon z using Postgis.

SELECT ST_Volume(geom) from grb;

And I get this error:

MultiPolygon is invalid : Polygon 0 is invalid: points don't lie in the same plane.

I also tried to make it a solid using ST_MakeSolid but that didn't work either.

This is the different kinds of data that is available:

Information about the geom

EDIT: Added example

SELECT
    ST_VOLUME(
        ST_GEOMFROMTEXT(
            'MultiPolygonZ (((141701.90499999999883585 167465.17699999999604188 48.4410000000000025, 141708.72500000000582077 167466.85500000001047738 48.4410000000000025, 141712.98499999998603016 167454.13000000000465661 48.4410000000000025, 141705.13899999999557622 167452.16300000000046566 48.4410000000000025, 141704.78700000001117587 167452.08000000001629815 48.4410000000000025, 141703.42300000000977889 167458.375 48.4410000000000025, 141701.90499999999883585 167465.17699999999604188 48.4410000000000025),(141701.90499999999883585 167465.17699999999604188 48.4410000000000025, 141701.90499999999883585 167465.17699999999604188 51.93999999999999773, 141708.72500000000582077 167466.85500000001047738 51.89999999999999858, 141708.72500000000582077 167466.85500000001047738 48.4410000000000025, 141701.90499999999883585 167465.17699999999604188 48.4410000000000025)),((141708.72500000000582077 167466.85500000001047738 48.4410000000000025, 141712.98499999998603016 167454.13000000000465661 48.4410000000000025, 141712.98499999998603016 167454.13000000000465661 53.13000000000000256, 141711.79899999999906868 167457.66899999999441206 55.75999999999999801, 141710.72800000000279397 167460.8690000000060536 53.42999999999999972, 141708.72500000000582077 167466.85500000001047738 51.89999999999999858, 141708.72500000000582077 167466.85500000001047738 48.4410000000000025)),((141703.42300000000977889 167458.375 48.4410000000000025, 141703.42300000000977889 167458.375 53.42000000000000171, 141703.31099999998696148 167458.87599999998928979 53.42000000000000171, 141701.90499999999883585 167465.17699999999604188 51.93999999999999773, 141701.90499999999883585 167465.17699999999604188 48.4410000000000025, 141703.42300000000977889 167458.375 48.4410000000000025)),((141704.78700000001117587 167452.08000000001629815 48.4410000000000025, 141704.78700000001117587 167452.08000000001629815 53.17999999999999972, 141703.97899999999208376 167455.80400000000372529 55.87000000000000455, 141703.42300000000977889 167458.375 53.42000000000000171, 141703.42300000000977889 167458.375 48.4410000000000025, 141704.78700000001117587 167452.08000000001629815 48.4410000000000025)),((141703.97899999999208376 167455.80400000000372529 55.87000000000000455, 141711.79899999999906868 167457.66899999999441206 55.75999999999999801, 141712.98499999998603016 167454.13000000000465661 53.13000000000000256, 141705.13899999999557622 167452.16300000000046566 53.1769999999999996, 141704.78700000001117587 167452.08000000001629815 53.17999999999999972, 141703.97899999999208376 167455.80400000000372529 55.87000000000000455),(141705.13899999999557622 167452.16300000000046566 48.4410000000000025, 141705.13899999999557622 167452.16300000000046566 53.1769999999999996, 141704.78700000001117587 167452.08000000001629815 53.17999999999999972, 141704.78700000001117587 167452.08000000001629815 48.4410000000000025, 141705.13899999999557622 167452.16300000000046566 48.4410000000000025),(141712.98499999998603016 167454.13000000000465661 48.4410000000000025, 141712.98499999998603016 167454.13000000000465661 53.13000000000000256, 141705.13899999999557622 167452.16300000000046566 53.1769999999999996, 141705.13899999999557622 167452.16300000000046566 48.4410000000000025, 141712.98499999998603016 167454.13000000000465661 48.4410000000000025)),((141710.72800000000279397 167460.8690000000060536 53.42999999999999972, 141703.31099999998696148 167458.87599999998928979 53.42000000000000171, 141701.90499999999883585 167465.17699999999604188 51.93999999999999773, 141708.72500000000582077 167466.85500000001047738 51.89999999999999858, 141710.72800000000279397 167460.8690000000060536 53.42999999999999972)),((141711.79899999999906868 167457.66899999999441206 55.75999999999999801, 141703.97899999999208376 167455.80400000000372529 55.87000000000000455, 141703.42300000000977889 167458.375 53.42000000000000171, 141703.31099999998696148 167458.87599999998928979 53.42000000000000171, 141710.72800000000279397 167460.8690000000060536 53.42999999999999972, 141711.79899999999906868 167457.66899999999441206 55.75999999999999801)))'
    )
);
  • Please paste the geometry in some human readable format, it is impossible to tell from this information. – John Powell Feb 14 at 14:42
  • Edit to provide a reproducible example. – Andre Silva Feb 14 at 15:12
0

As per ST_Volume documentation, you should make your objects as POLYHEDRALSURFACE, then convert them to solids with ST_MakeSolid and then use ST_Volume on that.

By my knowledge there is no way how to model kompletely vertical planes with simple geometry objects with Z. Overlaping coordinates (same X,Y but different Z) are considered as errors. This also apply to multi* type of geometry. If they overlap in x,y they are considered as errors even they have different Z.

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.