Posted on

STIsMeasureDecreasing

STIsMeasureDecreasing — Checks if M values decrease in value over the whole linestring.

Function Specification.

Function [lrs].[STIsMeasureDecreasing] (
                  @p_linestring geometry
         )
Returns varchar(5)

Description.

Checks all measures of all vertices in a linestring from start to end.

Computes difference between each pair of measures.

If all measure differences decrease then TRUE is returned, otherwise FALSE.

For non-measured line-strings the value is always TRUE.

Supports Linestrings with CircularString elements (2012).

Result.

Returns TRUE if measures are decreasing; FALSE otherwise.

Example.

select [lrs].[STIsMeasureDecreasing](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3,2 2 3 4),(3 3 4 5,4 4 5 6))',0)) as is_decreasing
union all
select [lrs].[STIsMeasureDecreasing](geometry::STGeomFromText('MULTILINESTRING((4 4 5 6,3 3 4 5),(2 2 3 4,1 1 2 3))',0)) as is_decreasing
union all
select [lrs].[STIsMeasureDecreasing](geometry::STGeomFromText('CIRCULARSTRING (3 6.325 NULL 0, 0 7 NULL 3.08, -3 6.325 NULL 6.15)',0)) as is_decreasing
GO

is_decreasing
FALSE
TRUE
FALSE
Leave a Reply

Your email address will not be published. Required fields are marked *