[postgis-users] ST_Envelope

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Tue Apr 22 04:45:24 PDT 2008


Sam Giffney wrote:
> On Postgis 1.3.2 (tested on Windows and Debian Lenny)
> 
> A LINESTRING which runs "parallel to the grid lines" (excuse my poor
> GIS terminology) returns a LINESTRING instead of a POLYGON for the
> envelope.
> 
> postgis=> select
> ST_AsText(ST_Envelope(ST_GeomFromText('LINESTRING(-36.91410
> 174.90900,-36.91410 174.91017)')));
>                     st_astext
> -------------------------------------------------
>  LINESTRING(-36.9141 174.909,-36.9141 174.91017)
> (1 row)
> 
> The documentation states that ST_Envelope should return a POLYGON.
> I think I understand why the LINESTRING is returned, but shouldn't the
> documentation list that as an option?
> 
> Cheers,
> Sam


Hi Sam,

It is the documentation that is wrong. The change was made in order to 
ensure that only valid geometries can be returned from the ST_Envelope() 
/ bounding box functions. See 
http://postgis.refractions.net/pipermail/postgis-commits/2007-October/000180.html 
for more information. Any doc patches gratefully received :)


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-users mailing list