[postgis-users] centroid() and AddGeometryColumn() questions

matt.pettis at thomson.com matt.pettis at thomson.com
Tue Nov 21 11:04:07 PST 2006


Hi,
 
I am trying to add a column to my table that lists the centroids the
polygon described in the 'the_geom' field.  I use the following, which
works (I think), but of which I have questions:
 
SELECT AddGeometryColumn( '', 'shp_mcd', 'centroid', -1, 'POINT', 2 );
UPDATE shp_mcd SET centroid = centroid ( the_geom );
 
My question is about the final argument to AddGeometryColumn.
Documentation states that centroid() returns a POINT.  I figure that
that implies that the last argument should then be a 0, not a 2.  But if
I use a 0 in the last field, the updated doesn't work -- it tells me
that i violate a dimension constraint.  Can someone explain why I need
to have a 2 as the last argument and not a 0?  It doesn't make sense to
me.
 
Thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061121/faf4d354/attachment.html>


More information about the postgis-users mailing list