geometry: Extended Methods on Geometry Instances
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 diagnostics, simplification, or interchange beyond common OGC methods.
Check method compatibility level and output dimensions before using it in shared query code.
Check your work AsTextZM preserves Z and M. Reduce simplifies in the same planar 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 @shape geometry;
SET @shape = geometry::STGeomFromText(N'LINESTRING(0 0 2 10, 3 4 5 20)', 0);
SELECT @shape.AsTextZM() AS route_with_z_and_m, @shape.Reduce(0.1).AsTextZM() AS reduced_route,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.