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

Paul Ramsey pramsey at refractions.net
Wed Sep 19 12:43:03 PDT 2007


Charlie Savage wrote:
> 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.

Hmmm... for an linear envelope would returning a linestring not make 
more sense?

> 
> Charlie
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey at refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632



More information about the postgis-users mailing list