[postgis-devel] Conversion from box3d to box2d changes bounds

Charlie Savage cfis at savagexi.com
Sat Sep 22 16:13:28 PDT 2007


> BOX2DFLOAT4 *
> box3d_to_box2df(BOX3D *box)
> {
>         ...
>     result->xmin = nextDown_f(box->xmin);
>     result->xmax = nextUp_f(box->xmax);
> }
> 
> Notice it *intentionally* changes the bounding box.  I assume there is a 
> good reason for this, but curious what it is.

Ah - its the double to float conversion.  Ok - so envelope works now by 
checking the bounds in 2d, using this method:

getbox2d_p(SERIALIZED_FORM(geom), &box)


It seems that needs to change to use the 3d box as provided by this method:

compute_serialized_box3d_p(SERIALIZED_FORM(geom), &box)

This avoids the down-conversion and returns the correct results.

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-devel/attachments/20070922/3df1d8ad/attachment.bin>


More information about the postgis-devel mailing list