I am using Postgres 9.5.2 and PostGIS 2.2.2.
According to the documentation ST_PointOnSurface
should not drop Z. This is what happens. If I run
SELECT ST_AsText(cell) AS pt FROM cells LIMIT 1
I get
POLYGON Z ((157.215247156568 3779.5275740661 76.0620819960913,157.215247156568 3937.00787401575 76.0620819960913,3.4336355447806e-07 3937.00787401575 66.9291338782187,3.43363565136201e-07 3779.5275740661 66.9291338782187,157.215247156568 3779.5275740661 76.0620819960913))
as expected (Z conserved). However, if I run
SELECT ST_AsText(ST_PointOnSurface(cell)) AS pt FROM cells LIMIT 1
or
SELECT ST_AsText(ST_Centroid(cell)) AS pt FROM cells LIMIT 1
I get
POINT(78.6076237499659 3858.26772404092)
and the 3rd coordinate is gone.
Am I doing something wrong?