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

Paul Ramsey pramsey at refractions.net
Tue Nov 21 12:04:46 PST 2006


Matt,

COORD_DIMENSION is about the number of coordinates in each vertex (for 
PostGIS, 2, 3 or 4).  The dimensionality of the geometry is already 
given, by specifying POINT. To specify it again as "0" would be redundant.

P

matt.pettis at thomson.com wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list