geometry.AsTextZM
spatial method AsTextZM (instance.AsTextZM(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- nvarchar(max)
- Return type
- SQL Server return type: nvarchar(max) CLR return type: SqlChars
Syntax at a glance
.AsTextZM ()
Work example
Use geometry.AsTextZM to export readable text with Z and M ordinates.
Check whether the receiving parser preserves extra ordinates. Keep the geometry type and SRID in the review.
Check your work The text includes Z and M. M is a measure, not elevation.
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_wkt_with_zm,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.