STSetMeasure

STSetMeasure is a TSQL function that adds or updates (replaces) M value of supplied geometry point.

TSQL Function Specification.

    Function [lrs].[STSetMeasure] (
               @p_point    geometry,
               @p_measure  float,
               @p_round_xy int = 3,
               @p_round_zm int = 2
             )
     Returns geometry 

Description.

Function that adds/updates M ordinate of the supplied @p_point.

The updated coordinate’s XY ordinates are rounded to @p_round_xy number of decimal digits of precision.

The updated coordinate’s ZM ordinates are rounded to @p_round_ZM number of decimal digits of precision.

Parameters.

    @p_point     (geometry) - Supplied point geometry.
    @p_measure   (float)    - New M value.
    @p_round_xy  (int)      - Decimal degrees of precision to which calculated XY ordinates are rounded.
    @p_round_zm  (int)      - Decimal degrees of precision to which calculated ZM ordinates are rounded.

Result.

The function returns the supplied point with its M ordinate set to the supplied measure value.

Example.

SELECT [lrs].[STSetMeasure] (
         geometry::STPointFromText('POINT(0 0)',0),
         1,
         3, 2 
       ).AsTextZM() as updatedPoint
GO

updatedPoint
POINT(0 0 NULL 1)