geometry.HasM
spatial method HasM (instance.HasM(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- bit
- Return type
- SQL Server return type: bit CLR return type: Boolean
Syntax at a glance
.HasM
Work example
Use geometry.HasM to check whether measured coordinates are present.
Check this before reading M and keep route measures distinct from elevation. Keep the geometry type and SRID in the review.
Check your work The point has M=6. M is a route measure, not a spatial coordinate or 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'POINT(3 4 5 6)', 0);
SELECT @shape.HasM AS has_measure, @shape.M AS measure_value,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.