Sei sulla pagina 1di 2

PostGIS 1.5.

1 Manual
261 / 315

-- and render the extended text representation of that geometry


SELECT ST_SetSRID(ST_Extent(the_geom),2249) as bextent FROM sometable;
bextent
-------------------------------------------------------------------------------SRID=2249;POLYGON((739651.875 2908247.25,739651.875 2970042.75,794875.8125 2970042.75,
794875.8125 2908247.25,739651.875 2908247.25))

See Also
ST_AsEWKT, ST_Extent3D, ST_SetSRID, ST_SRID

7.12.7 ST_Extent3D
Name
ST_Extent3D an aggregate function that returns the box3D bounding box that bounds rows of geometries.

Synopsis
box3d ST_Extent3D(geometry set geomfield);

Description
ST_Extent3D returns a box3d (includes Z coordinate) bounding box that encloses a set of geometries. The ST_Extent3D function
is an "aggregate" function in the terminology of SQL. That means that it operates on lists of data, in the same way the SUM()
and AVG() functions do.
Since it returns a bounding box, the spatial Units are in the units of the spatial reference system in use denoted by the SRID

Note
Since ST_Extent3D returns a bounding box, the SRID meta-data is lost. Use ST_SetSRID to force it back into a
geometry with SRID meta data. The coordinates are in the units of the spatial ref of the orginal geometries.

This function supports 3d and will not drop the z-index.


This method supports Circular Strings and Curves

Examples
SELECT ST_Extent3D(foo.the_geom) As
FROM (SELECT ST_MakePoint(x,y,z) As
FROM generate_series(1,3) As x
CROSS JOIN generate_series(1,2)
CROSS JOIN generate_series(0,2)
b3extent
-------------------BOX3D(1 1 0,3 2 2)

b3extent
the_geom
As y
As Z) As foo;

--Get the extent of various elevated circular strings

PostGIS 1.5.1 Manual


262 / 315

SELECT ST_Extent3D(foo.the_geom) As b3extent


FROM (SELECT ST_Translate(ST_Force_3DZ(ST_LineToCurve(ST_Buffer(ST_MakePoint(x,y),1))),0,0, z) As the_geom
FROM generate_series(1,3) As x
CROSS JOIN generate_series(1,2) As y
CROSS JOIN generate_series(0,2) As Z) As foo;
b3extent
-------------------BOX3D(1 0 0,4 2 2)

See Also
ST_Extent, ST_Force_3DZ

7.12.8 Find_SRID
Name
Find_SRID The syntax is find_srid(<db/schema>, <table>, <column>) and the function returns the integer SRID of the specified
column by searching through the GEOMETRY_COLUMNS table.

Synopsis
integer Find_SRID(varchar a_schema_name, varchar a_table_name, varchar a_geomfield_name);

Description
The syntax is find_srid(<db/schema>, <table>, <column>) and the function returns the integer SRID of the specified column by
searching through the GEOMETRY_COLUMNS table. If the geometry column has not been properly added with the AddGeometryColumns() function, this function will not work either.

Examples
SELECT Find_SRID(public, tiger_us_state_2007, the_geom_4269);
find_srid
---------4269

See Also
ST_SRID

7.12.9 ST_Mem_Size
Name
ST_Mem_Size Returns the amount of space (in bytes) the geometry takes.

Potrebbero piacerti anche