R/coords-translate.R
coords_point_translate_wkt.Rd
These functions provide the reverse function of wkt_coords()
and company: they parse vectors of coordinate values into well-known
formats. Polygon rings are automatically closed, as
closed rings are assumed or required by many parsers.
coords_point_translate_wkt(x, y, z = NA, m = NA, precision = 16, trim = TRUE)
coords_point_translate_wkb(
x,
y,
z = NA,
m = NA,
endian = wk::wk_platform_endian(),
buffer_size = 2048
)
coords_linestring_translate_wkt(
x,
y,
z = NA,
m = NA,
feature_id = 1L,
precision = 16,
trim = TRUE
)
coords_linestring_translate_wkb(
x,
y,
z = NA,
m = NA,
feature_id = 1L,
endian = wk::wk_platform_endian(),
buffer_size = 2048
)
coords_polygon_translate_wkt(
x,
y,
z = NA,
m = NA,
feature_id = 1L,
ring_id = 1L,
precision = 16,
trim = TRUE
)
coords_polygon_translate_wkb(
x,
y,
z = NA,
m = NA,
feature_id = 1L,
ring_id = 1L,
endian = wk::wk_platform_endian(),
buffer_size = 2048
)
Vectors of coordinate values
The rounding precision to use when writing (number of decimal places).
Trim unnecessary zeroes in the output?
Force the endian of the resulting WKB.
The buffer size to use when converting to WKB.
Vectors for which a change in
sequential values indicates a new feature or ring. Use factor()
to convert from a character vector.
*_translate_wkt()
returns a character vector of
well-known text; *_translate_wkb()
returns a list
of raw vectors.
coords_point_translate_wkt(1:3, 2:4)
#> [1] "POINT (1 2)" "POINT (2 3)" "POINT (3 4)"
coords_linestring_translate_wkt(1:5, 2:6, feature_id = c(1, 1, 1, 2, 2))
#> [1] "LINESTRING (1 2, 2 3, 3 4)" "LINESTRING (4 5, 5 6)"
coords_polygon_translate_wkt(c(0, 10, 0), c(0, 0, 10))
#> [1] "POLYGON ((0 0, 10 0, 0 10, 0 0))"