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

Charlie Savage cfis at savagexi.com
Wed Sep 19 12:37:19 PDT 2007


Hi Martin,

> Charlie, this is not a problem.  Floating point rounding error only 
> comes into play when you are doing computations using numeric 
> operations.  Extent computation only uses comparison operations, and 
> these are exact.

Ah - that's interesting.

   So if a BBox is computed for a geometry and it has the
> max and min x and y being exactly the same, it can be determined to be a 
> Point, with no worry about error.  (Conversely, if a geometry is not a 
> point, it must have at least two coordinates with different Xs or Ys, 
> and so its BBox will have a non-zero extent.

Thanks for the information.  Ok, then I'll see if I can fix up the bbox2 
  to geometry conversion so it returns a point if either xmin=xmax or 
ymin=ymax.  Currently it returns an invalid polygon - same problem that 
envelope had.

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/20070919/35645f93/attachment.bin>


More information about the postgis-users mailing list