set_third_dimension {flexpolyline}R Documentation

Set third dimension of a flexible polyline encoded string

Description

This function decodes the flexible polyline encoded line, changes the third dimension and encodes the line again.

Usage

set_third_dimension(
  encoded,
  third_dim_name,
  precision = 5L,
  third_dim_precision = 5L
)

Arguments

encoded

character, encoded flexible polyline string.

third_dim_name

character, name of the third dimension to set (ABSENT, LEVEL, ALTITUDE, ELEVATION, CUSTOM1, CUSTOM2).

precision

integer, precision to use in encoding (between 0 and 15, default=5).

third_dim_precision

integer, precision to use in encoding for the third dimension (between 1 and 15, default=5).

Value

The line with the new third dimension as string in the flexible polyline encoding format.

Note

The precision is not read from the header of the encoded line. Therefore it must be provided as a parameter for re-encoding.

Examples

# 2d line (nothing happens...)
set_third_dimension("BFoz5xJ67i1B1B7PzIhaxL7Y", "ELEVATION")

# 3d line
set_third_dimension("BlBoz5xJ67i1BU1B7PUzIhaUxL7YU", "ELEVATION")

[Package flexpolyline version 0.3.0 Index]