[postgis-users] How to get the centroid of an bounding box using st_extent

Charlie Savage cfis at savagexi.com
Tue Sep 18 20:56:50 PDT 2007


It turns out that st_extent is hundreds of times faster than Envelope. 
But I run into a problem when using it:

select st_extent('POINT(10 10)')
"BOX(10 10,10 10)"

But if you do this:

select asText(centroid(st_extent('POINT(10 10)')))
"GEOMETRYCOLLECTION EMPTY"


Which is the same issue I mentioned a couple weeks ago where 
Envelope('POINT(10 10)') doesn't return a point like it should.

So I'd like to use st_extent, but a need a way to get a valid point that 
represents the center of the bounds instead of an empty collection.  How?

Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070918/65743d3b/attachment.bin>


More information about the postgis-users mailing list