[postgis-users] Re: st_centroid Points not on Polygon

Sufficool, Stanley ssufficool at rov.sbcounty.gov
Mon May 4 13:16:13 PDT 2009


That really doesn't accomplish much since the return value from
st_centroid is a point, you will be getting back the same point without
any guarantee that it is on the surface.

St_pointonsurface(the_geom) suffices for my use case as I need dynamic
labelpoints from polygons clipped to a map extent.

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Gmail
> Sent: Monday, May 04, 2009 11:28 AM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Re: st_centroid Points not on Polygon
> 
> 
> I hope that I'm not jumping in on the conversation, but this 
> has yet to fail me:
> 
> <code>
> insert into layer_centroids(the_geom, polygon_id)
> select
> 	ST_PointOnSurface(ST_Centroid(layer_polygons.the_geom)),
> 	layer_polygons.polygon_id
> from layer_polygons;
> </code>
> 
> My polygons consist of census boundaries and tracks. 
> 
> cheers,
> dassouki
> 
> _______________________________________________
> 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