Opened 12 years ago

Closed 12 years ago

#1322 closed defect (wontfix)

lwgeom_from_wkt doesn't initialize LWGEOM.bbox

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

Description

While adding tests for GML output I found that an LWGEOM constructed via lwgeom_from_wkt is giving a LWGEOM.bbox with value 0x8. Sounds like an uninitialized box. Is it meant to be filled ? If not it should be NULL, I guess.

Beside, the WKT is a 2 points LINESTRING, shouldn't it have a bounding box ?

Change History (6)

comment:1 by strk, 12 years ago

Resolution: invalid
Status: newclosed

I'll take it back, the bbox is really NULL. I'll file another bug when it is more clear where the bug is.

comment:2 by strk, 12 years ago

Resolution: invalid
Status: closedreopened

Actually, I'll let Paul close this if it is by design that lwgeom_from_wkt does _not_ initialize a bounding box.

comment:3 by strk, 12 years ago

There's no function in liblwgeom.h to get the BOX of an LWGEOM ? Or what am I missing ?

comment:4 by strk, 12 years ago

The only ones I find are:

liblwgeom.h:extern int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox);
liblwgeom.h:extern int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox);
liblwgeom.h:extern int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox);

It seems to me that we should have a single public function taking an LWGEOM and reading it's GBOX into the provided GBOX output parameter. Returning 1 on success and 0 on error (no box == empty geometry).

The function could take the LWGEOM by const pointer by still cache the computation.

comment:5 by strk, 12 years ago

#1323 would be a use case for a method to extract (possibly cached) bounding box from an LWGEOM.

comment:6 by strk, 12 years ago

Resolution: wontfix
Status: reopenedclosed

Ok, Paul confirmed it's by design, and makes sense. I field #1324 for implementing the lazy BBOX constructor.

Note: See TracTickets for help on using tickets.