[postgis-devel] Buck Rogers and the 3rd Dimension

Paul Ramsey pramsey at opengeo.org
Fri Oct 30 22:14:24 PDT 2009


While updating the old geometry spheroid functions, I noted the
existence of a length3d_spheroid() variant. It is actually the default
call for st_length_spheroid() as it happens.

The kinds of things you have to pass into this function to get
sensible results are pretty restricted, as it turns out. For example,

st_length_spheroid('LINESTRING(0 0 1000, 0 0.001 1001)',
'SPHEROID["WGS84", 6378137,298.257222101]')

Note that the units of Z are meters while the units of X and Y are
degrees. To get a sensible answer out, in fact, the units of your
altitude have to match the units of your spheroid.

Anyhow, my geography routines right now are strictly 2D so I haven't
renovated this particular variant, but it's put my in the mind of
wondering what the right thing to do is, in geography. If I get a '3D'
geography, do I assume the third dimension is in meters? Do I
calculate a "3D" length (or distance?) by default? That's what our
geometry routines do right now, and it hasn't caused harm yet.

It seems like an interesting submerged assumption in the geodetic
space, that the units of your extra dimension will match the units of
the axes of your spheroid.

As I recall, we added this function many years back, to calculate as
exactly as possible the drive lengths of roads in a road network (BC
is a hilly place). Not sure if anyone else is using it. And still not
sure if a "length3d_spheroid()" function is a wise proposition in
general, given the required assumptions.

P.



More information about the postgis-devel mailing list