[postgis-users] Getting the exact extent of a geometry

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed Dec 16 13:09:26 PST 2009


Hi,

ST_Envelope(geometry) returns a kind of degenerated version (float4s instead of float8s) of the extent of a geometry based on the cached BOX2D and ST_Extent(geometry) is an aggregate.

Is there a non aggregate function which returns the exact extent (float8s) of a geometry?

Try:

SELECT ST_AsText(ST_Envelope('LINESTRING(0 0, 1.00000000000001 1)'::geometry))
UNION ALL
SELECT ST_AsText(ST_Box2D('LINESTRING(0 0, 1.00000000000001 1)'::geometry))
UNION ALL
SELECT ST_AsText(ST_Extent('LINESTRING(0 0, 1.00000000000001 1)'::geometry));

Thanks,

Pierre




More information about the postgis-users mailing list