Вы находитесь на странице: 1из 2

PostGIS 1.5.

1 Manual
258 / 315

Description
Return the estimated extent of the given spatial table. The estimated is taken from the geometry columns statistics. The current
schema will be used if not specified.
For PostgreSQL>=8.0.0 statistics are gathered by VACUUM ANALYZE and resulting extent will be about 95% of the real one.
For PostgreSQL<8.0.0 statistics are gathered by update_geometry_stats() and resulting extent will be exact.
This method supports Circular Strings and Curves

Examples
SELECT ST_Estimated_extent(ny, edges, the_geom);
--result-BOX(-8877653 4912316,-8010225.5 5589284)
SELECT ST_Estimated_Extent(feature_poly, the_geom);
--result-BOX(-124.659652709961 24.6830825805664,-67.7798080444336 49.0012092590332)

See Also
ST_Extent

7.12.5 ST_Expand
Name
ST_Expand Returns bounding box expanded in all directions from the bounding box of the input geometry. Uses doubleprecision

Synopsis
geometry ST_Expand(geometry g1, float units_to_expand);
box2d ST_Expand(box2d g1, float units_to_expand);
box3d ST_Expand(box3d g1, float units_to_expand);

Description
This function returns a bounding box expanded in all directions from the bounding box of the input geometry, by an amount
specified in the second argument. Uses double-precision. Very useful for distance() queries, or bounding box queries to add an
index filter to the query.
There are 3 variants of this. The one that takes a geometry will return a POLYGON geometry representation of the bounding box
and is the most commonly used variant.
ST_Expand is similar in concept to ST_Buffer except while buffer expands the geometry in all directions, ST_Expand expands
the bounding box an x,y,z unit amount.
Units are in the units of the spatial reference system in use denoted by the SRID

PostGIS 1.5.1 Manual


259 / 315

Note
Pre 1.3, ST_Expand was used in conjunction with distance to do indexable queries.
Something of
the form the_geom && ST_Expand(POINT(10 20), 10) AND ST_Distance(the_geom, POINT(10 20)) < 10 Post 1.2, this was replaced with the easier ST_DWithin construct.

Note
Bounding boxes of all geometries are currently 2-d even if they are 3-dimensional geometries.

Note
Availability: 1.5.0 behavior changed to output double precision instead of float4 coordinates.

Examples

Note
Examples below use US National Atlas Equal Area (SRID=2163) which is a meter projection

--10 meter expanded box around bbox of a linestring


SELECT CAST(ST_Expand(ST_GeomFromText(LINESTRING(2312980 110676,2312923 110701,2312892
110714), 2163),10) As box2d);
st_expand
-----------------------------------BOX(2312882 110666,2312990 110724)

--10 meter expanded 3d box of a 3d box


SELECT ST_Expand(CAST(BOX3D(778783 2951741 1,794875 2970042.61545891 10) As box3d),10)
st_expand
----------------------------------------------------BOX3D(778773 2951731 -9,794885 2970052.61545891 20)
--10 meter geometry astext rep of a expand box around a point geometry
SELECT ST_AsEWKT(ST_Expand(ST_GeomFromEWKT(SRID=2163;POINT(2312980 110676)),10));
st_asewkt
------------------------------------------------------------------------------------------------- SRID=2163;POLYGON((2312970 110666,2312970 110686,2312990 110686,2312990 110666,2312970
110666))

See Also
ST_AsEWKT, ST_Buffer, ST_DWithin, ST_GeomFromEWKT,ST_GeomFromText, ST_SRID

7.12.6 ST_Extent
Name
ST_Extent an aggregate function that returns the bounding box that bounds rows of geometries.

Вам также может понравиться