STPercentageToMeasure

STPercentageToMeasure — Converts supplied Percentage value to a Measure.

Function Specification.

Function [lrs].[STPercentageToMeasure] (
                  @p_linestring geometry,
                  @p_percentage Float
         )
Returns varchar(5)

Description.

The supplied percentage value (between 0 and 100) is multipled by the measure range (see STMeasureRange) to return a measure value between the start and end measures.

For non measured line-strings all values are computed using lengths.

Parameters.

    @p_linestring (geometry) - Supplied Linestring geometry.
    @p_percentage    (float) - Percentage within linestring: from 0 to 100.

Result.

Returns measure value at the provided percentage along the linestring’s measure range.

Example.

select 50.0 as percentage,
       [lrs].[STStartMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0)) as start_measure,
       [lrs].[STEndMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0)) as end_measure,
       [lrs].[STPercentageToMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0),50) as measure
union all
select 80.0 as percentage,
       [lrs].[STStartMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0)) as start_measure,
       [lrs].[STEndMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0)) as end_measure,
       [lrs].[STPercentageToMeasure](geometry::STGeomFromText('MULTILINESTRING((1 1 2 3, 2 2 3 4),(3 3 4 5,4 4 5 6))',0),80)
union all
select 10.0 as percentage,
       [lrs].[STStartMeasure](geometry::STGeomFromText('CIRCULARSTRING (3 6.325 NULL 0, 0 7 NULL 3.08, -3 6.325 NULL 6.15)',0)) as start_measure,
       [lrs].[STEndMeasure](geometry::STGeomFromText('CIRCULARSTRING (3 6.325 NULL 0, 0 7 NULL 3.08, -3 6.325 NULL 6.15)',0)) as end_measure,
       [lrs].[STPercentageToMeasure](geometry::STGeomFromText('CIRCULARSTRING (3 6.325 NULL 0, 0 7 NULL 3.08, -3 6.325 NULL 6.15)',0),10)
GO

percentage start_measure end_measure measure
      50.0             3           6 4.5
      80.0             3           6 5.4
      10.0             0        6.15 0.615