geometry: OGC Static Geometry Methods
none (documentation, rules or examples)
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
n/a (reference page)
Work example
Use geometry methods for construction from coordinates, text, markup, or binary input.
Choose input format and SRID, then validate type and coordinate order.
Check your work The 4-by-4 lot contains its entrance and has area 16 square coordinate units.
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 @lot geometry;
SET @lot = geometry::STPolyFromText(N'POLYGON((0 0, 4 0, 4 4, 0 4, 0 0))', 0);
DECLARE @entrance geometry;
SET @entrance = geometry::STPointFromText(N'POINT(2 2)', 0);
SELECT @lot.STContains(@entrance) AS entrance_inside,
@lot.STArea() AS lot_area_in_square_coordinate_units,
@entrance.STAsText() AS entrance_point,
@lot.STIsValid() AS lot_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.