[postgis-devel] confused by bbox (fit or not fit)
Paul Ramsey
pramsey at cleverelephant.ca
Tue Jul 6 07:49:23 PDT 2021
On Tue, Jul 6, 2021 at 5:38 AM Sandro Santilli <strk at kbt.io> wrote:
> I'm struggling with an issue with topology face.mbr
> fields having values which sometime are "fit" and
> sometimes are "slighly larger".
>
> Trying to debug the issue I'm going deep into
> lwgeom_get_bbox and wondering in which occurrence
> could the bbox returned by that call be "loose".
>
> My understanding was that starting from the rewrite
> of the binary representation we made it so the bbox
> was always using doubles, am I mistaken ?
>
You are mistaken. The ST_Extent() aggregate was changed to use the exact
bounds. The serialization (and the index) still use float boxes.
> If I'm right, why would those bbox ever be slighly
> larger than the actual bboxes ?
>
There are two (roughly) paths to get a gbox,
lwgeom_calculate_gbox(LWGEOM *) returns an exact box calculated from the
coordinates
gserialized_get_gbox_p(GSERIALIZED *) returns a box as fast as possible,
from the serialization. This can mean, variably, reading the float box off
the header, or reading the first few coordinates of a point or short
linestring, or reading all the coordinates (in the instance of a box-less
serialization, which is rare).
ST_Envelope() (for example) starts from lwgeom_calculate_gbox() so it
should be exact.
P
>
> --strk;
>
> () Free GIS & Flash consultant/developer
> /\ https://strk.kbt.io/services.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20210706/81b1d163/attachment.html>
More information about the postgis-devel
mailing list