geometry.STEnvelope
spatial method STEnvelope (instance.STEnvelope(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- geometry
- Return type
- SQL Server return type: geometry CLR return type: SqlGeometry
Syntax at a glance
STEnvelope ( )
Work example
Use geometry.STEnvelope to create a rectangular bound around a planar shape.
Use it for coarse filtering and keep the source for exact checks. Keep the geometry type and SRID in the review.
Check your work The envelope is the 5-by-5 bounding rectangle and includes space outside the L shape.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
-- Planar geometry. SRID 0 coordinates here are synthetic units, not metres.
DECLARE @shape geometry;
SET @shape = geometry::STGeomFromText(N'POLYGON((0 0, 5 0, 5 2, 2 2, 2 5, 0 5, 0 0))', 0);
SELECT @shape.STEnvelope().STAsText() AS axis_aligned_envelope,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.