Opened 12 years ago

Closed 12 years ago

#1324 closed task (fixed)

Provide a function to read an LWGEOM bounding box and stop reading it directly

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description (last modified by strk)

In order to simplify the code, we'd need a function that returns an LWGEOM's bounding box optionally caching it in the structure if not available.

I belive computing the BBOX of a multigeometry by combining the rounded BBOX of component geometries should yeld the same numbers as computing everything using doubles and rounding only at the end, although the operation would be slightly less performance (could be impossible to note even by a performance analisys tool).

Such new function could replace the public compute_bbox functions (there are 3 of them: wrapper, geodetic, cartesian) which could then be moved to the internal header.

Change History (5)

comment:1 by strk, 12 years ago

Description: modified (diff)

An open question is if such method should also take care of rounding the BBOX to floats or not. Such rounding would serve the purpose of always having the _same_ BBOX for the _same_ geometry, no matter if the BBOX was read from the serialized format (which uses floats) or computed from the actual coordinates.

comment:2 by strk, 12 years ago

A good companion to this function would be one that tells you if a geometry has a box known already or not. For GEOS shortcuts, for instance, it probably woulnd't make sense to force computation at the postgis side as GEOS will have to recompute the box anyway and will most likely have shortcircuits itself.

comment:3 by strk, 12 years ago

Owner: changed from pramsey to strk
Status: newassigned

comment:4 by strk, 12 years ago

lwgeom_add_bbox() does the lazy addition already. I've stubbed a lwgeom_get_bbox() function calling the lazy computer and returning what it gets as part of r8333 but found out that in case of an _empty_ geometry the lazy computer computes a bounding box composed by all zeroes. I don't think I like that.

What's the bounding box of an EMPTY geometry ? /me hopes we wont go to BOX EMPTY …

comment:5 by strk, 12 years ago

Resolution: fixed
Status: assignedclosed

r8335 make the new function public

Note: See TracTickets for help on using tickets.