[postgis-users] ndim vs. st_dimension and enforce_dims_coordinate constraint
Edward Bridges
postgis at eqbridges.com
Sun Jul 27 12:30:36 PDT 2008
Hello,
I have a table with a geometry column which the AddGeometryColumn stored
procedure has created a check constraint like so:
Check constraints:
"enforce_dims_coordinate" CHECK (ndims(coordinate) = 0)
So, this uses the internal function "ndims" to check the dimensionality
of the input coordinate.
However, I'm getting a discrepancy when inserting a point into this
column since ndims and st_dimensions are returning conflicting
(apparently) values:
rover=# select * from st_dimension( ST_GeomFromText('POINT(1 1)'));
st_dimension
--------------
0
(1 row)
rover=# select * from ndims( ST_GeomFromText('POINT(1 1)'));
ndims
-------
2
(1 row)
It seems that the ndims function returns only 2, 3, or 4; can someone
please explain why the differing values and how to insert data into a
point-type geometry column (seems to work fine with polygon) without
crossing the check constraint?
Thanks,
Ed
More information about the postgis-users
mailing list