[postgis-users] ST_Force3D and null/unknown altitude

Hugo Mercier hugo.mercier at oslandia.com
Thu Mar 17 00:26:28 PDT 2016

Hi Denis,

On 07/12/2015 15:30, Denis Rouzaud wrote:
> Hi all,
> If I understand correctly, Postgis does not handle NULL altitude in 3D
> geomtries.

That's what I understand as well.

> Hence, when using ST_Force3D, it sets the altitude to 0, which I find a
> bit inconvenient (and dangerous).

Could you explain why ?
The name of ST_Force3D is pretty clear for me: you are forcing the
geometry to change its type from 2D to 3D. And yes, a 3D geometry is
defined by its altitude. So if you know a geometry should be 3D but do
not know its altitude, it's not yet a real 3D object :)

> 1. Is there any ongoing or potential development towards handling null
> altitude in geometries or this is not feasible?
> 2. Do you have any good workaround? Like using -9999 and creating your
> own ST_Force3D?

My opinion is that it should be handled on the side of the application.
If you really want to store not-fully-defined 3D objects with postgis,
then yes you can use a special value that your application knows how to
deal with.

More information about the postgis-users mailing list