Modify well-known geometries

wkt_set_srid(wkt, srid, precision = 16, trim = TRUE)

wkb_set_srid(wkb, srid)

wkt_set_z(wkt, z, precision = 16, trim = TRUE)

wkb_set_z(wkb, z)

wkt_transform(wkt, trans, precision = 16, trim = TRUE)

wkb_transform(wkb, trans)

Arguments

wkt

A character vector containing well-known text.

srid

An integer spatial reference identifier with a user-defined meaning. Use NA to unset this value.

precision

The rounding precision to use when writing (number of decimal places).

trim

Trim unnecessary zeroes in the output?

wkb

A list() of raw() vectors, such as that returned by sf::st_as_binary().

z

A Z value that will be assigned to every coordinate in each feature. Use NA to unset this value.

trans

A 3x3 transformation matrix that will be applied to all coordinates in the input.

Value

An unclassed well-known vector with the same type as the input.

Examples

wkt_set_srid("POINT (30 10)", 1234)
#> [1] "SRID=1234;POINT (30 10)"
wkt_set_z("POINT (30 10)", 1234)
#> [1] "POINT Z (30 10 1234)"
wkt_transform(
  "POINT (0 0)",
  # translation +12 +13
  matrix(c(1, 0, 0, 0, 1, 0, 12, 13, 1), ncol = 3)
)
#> [1] "POINT (12 13)"