[postgis-devel] ST_Expand unexpected behavior

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Tue Sep 16 06:07:54 PDT 2008


Obe, Regina wrote:
> I'm not really quite sure whether to consider this a bug, but it seems
> like unexpected behavior to me.
> 
> 1) If I expand a 3d box, I get a 3d box back
> SELECT ST_Expand(CAST('BOX3D(778783 2951741 1,794875 2970042.61545891
> 10)' As box3d),10)
> 
> yields
> BOX3D(778773 2951731 -9,794885 2970052.61545891 20)
> 
> 2) However if I expand out a 3d geometry, I get back a 2d box. 
> 
> SELECT CAST(ST_Expand(ST_GeomFromEWKT('SRID=2163;LINESTRING(2312980
> 110676 1,2312923 110701 5,2312892 110714 2)'),12) As box3d);
> 
> yields
> SELECT CAST(ST_Expand(ST_GeomFromEWKT('SRID=2163;LINESTRING(2312980
> 110676 1,2312923 110701 5,2312892 110714 2)'),12) As box3d);
> 
> I understand this is because
> I assume we only keep 2d boxes around geometries, but to the casual user
> (or at least me with a casual user hat on, its unexpected behavior).
> 
> Should I just make a note of this in the docs? I presume there is no
> easy fix for this and since our indexes are all 2d, its not all that
> useful right now anyway.

Yeah, the current situation with functions returning BOX2D and BOX3D 
geometries is not good :(  In SVN trunk I'd like to work on removing 
these if possible so that only valid OGC geometries are returned.

As a matter of interest, can someone with SQL Server 2008 or Oracle 
Spatial confirm which datatype is returned for a query of the type 
"SELECT ST_Extent(col) FROM table"? Is it a geometry of type POLYGON?


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list