How to change area calculation, making use of altitude?
I am supposing that at Z=0 is the default (geoid surface) for PostGIS. So we can expect different area when Z=800 or Z=8000... But, using the tests below was not possible to obtain different results.
SELECT ST_Area(geom) as spheric_area,
ST_Area(geom_z) as spheric_area_z, -- ST_3DArea(geom_z) is error
ST_Area(geom,true) as area,
ST_Area(geom_z,true) as area_z
FROM (
SELECT ST_GeomFromText(
'POLYGON Z((-46.6342 -23.55057 800.0,-46.6342 -23.5492 800.0,-46.6328 -23.5492 800.0,-46.6328 -23.55057 800.0,-46.6342 -23.55057 800.0))',
4326
),
ST_GeomFromText(
'POLYGON((-46.6342 -23.55057,-46.6342 -23.5492,-46.6328 -23.5492,-46.6328 -23.55057,-46.6342 -23.55057))',
4326
)
) t1(geom_z,geom);
| spheric_area | spheric_area_z | area | area_z |
|---|---|---|---|
| 1.917999999997526e-06 | 1.917999999997526e-06 | 21688.81550103426 | 21688.81550103426 |
((edit after @TimothyDalton suggestion))
Try also ST_3DArea
CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;
SELECT ST_3DArea( geom_z) as area3d_z,
ST_3DArea( ST_Transform(geom_z,'+proj=isea') ) as area3d_z_isea,
ST_IsPlanar(geom_z)
FROM (
SELECT ST_GeomFromText(
'POLYGON Z((-46.6342 -23.55057 800.0,-46.6342 -23.5492 800.0,-46.6328 -23.5492 800.0,-46.6328 -23.55057 800.0,-46.6342 -23.55057 800.0))',
4326
)
) t1(geom_z);
Results: all same as ordinary ST_Area(),
- area3d_z = 1.917999999997526e-06
- area3d_z_isea = 21788.3 (not changes even even increasing altitude to 8000). Other projections (ex. Mercator or Albers) also not changes with altitude.
- It is a "planar geometry" (st_isplanar = t), so was expected no problem.
Notes for @jbalk and other comments
I am supposing that we can confirm theory with PostGIS: area increase when altitude increase (Earth radius).

The adoption of SRID 4326 (pure WGS84 with no projection) is to fix the solid angle (area in steradians), so the metric area "must" (hypothesis) to increase with Z.


geom_z, "No function matches the given name and argument types.". The only examples are POLYHEDRALSURFACE, and cites TIN... Perhaps need an extension... So it is a new subquestion: how to use ST_3DArea(geometry with altitude)? – Peter Krauss Dec 12 '21 at 11:52ST_3DArea()is ignoring the Z axis. – Peter Krauss Dec 12 '21 at 20:45