A wrapper function for decode that converts the input polylines, encoded in the flexible polyline enoding, to simple feature geometries of the sf package.

decode_sf(encoded, crs = sf::NA_crs_)

Arguments

encoded

character, encoded flexible polyline string.

crs

integer or character, coordinate reference system to assign to the sf object (default = sf::NA_crs_).

Value

An sf object, containing the geometries of the decoded lines (Geometry type: "LINESTRING").

Note

The function returns an sf object, therefore the input set of encoded polylines must be of consistent dimension (e.g "XY", "XYM" or "XYZ") to meet the requirements of the constructor of sf objects. For mixed dimensions use the decode function directly.

Examples

decode_sf("B1Voz5xJ67i1Bgkh9B")
#> Simple feature collection with 1 feature and 2 fields
#> Geometry type: POINT
#> Dimension:     XYZ
#> Bounding box:  xmin: 8.69821 ymin: 50.10228 xmax: 8.69821 ymax: 50.10228
#> z_range:       zmin: 10 zmax: 10
#> CRS:           NA
#>   id      dim3                      geometry
#> 1  1 ELEVATION POINT Z (8.69821 50.10228 10)
decode_sf("BFoz5xJ67i1B1B7PlU9yB")
#> Simple feature collection with 1 feature and 2 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 8.68752 ymin: 50.09878 xmax: 8.69821 ymax: 50.10228
#> CRS:           NA
#>   id   dim3                       geometry
#> 1  1 ABSENT LINESTRING (8.69821 50.1022...
decode_sf("BlXoz5xJ67i1Bgkh9B1B7Pgkh9BzIhagkh9BqK-pB_ni6D")
#> Simple feature collection with 1 feature and 2 fields
#> Geometry type: POLYGON
#> Dimension:     XYM
#> Bounding box:  xmin: 8.6915 ymin: 50.10063 xmax: 8.69821 ymax: 50.10228
#> m_range:       mmin: 10 mmax: 30
#> CRS:           NA
#>   id    dim3                       geometry
#> 1  1 CUSTOM1 POLYGON M ((8.69821 50.1022...