Opened 13 years ago

Closed 13 years ago

#1000 closed defect (fixed)

box3d_extent output is 2d, casted to box3d makes up random numbers

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

Description

create table test (g geometry);
insert into test values ('POINT(0 0)');
insert into test values ('POINT(10 10)');
select st_extent(g) from test;
 BOX(0 0,10 10)
select st_extent(g)::box3d from test;
 BOX3D(0 0 6.90298898654887e-310,10 10 6.90298898647219e-310)

Change History (3)

comment:1 by simoc, 13 years ago

Cc: simoc added

Problem is that struct returned to SQL from C function BOX3D_extent_to_BOX3D() is not fully initialised.

Solution is to add two lines to this C function. A diff of the required changes is:

$ diff /tmp/postgis-2.0.0SVN/postgis/lwgeom_box3d.c ./postgis/lwgeom_box3d.c
186a187,188
>       out->zmin = 0;
>       out->zmax = 0;

I am working with the current SVN revision 7429 postgis-2.0.0SVN.tar.gz source.

Can someone with commit access please commit this change.

comment:2 by mcayland, 13 years ago

Thanks for the report. This looks like a particular solution, however I would much rather like to change the patch like this:

out→zmin = in→zmin; out→zmax = in→zmax;

And then ensure that zmax/zmin are set to zero when the box3d_extent is created. If you could rework your patch in this way then I am happy to review and commit it.

comment:3 by strk, 13 years ago

Resolution: fixed
Status: newclosed

Seems fixed as of r8414

Note: See TracTickets for help on using tickets.