wk (version 0.3.0)

coords_point_translate_wkt: Parse coordinates into well-known formats

Description

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.

Usage

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_point_translate_wksxp(x, y, z = NA, m = NA)

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_linestring_translate_wksxp(x, y, z = NA, m = NA, feature_id = 1L)

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 )

coords_polygon_translate_wksxp( x, y, z = NA, m = NA, feature_id = 1L, ring_id = 1L )

Arguments

x, y, z, m

Vectors of coordinate values

precision

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

trim

Trim unnecessary zeroes in the output?

endian

For WKB writing, 0 for big endian, 1 for little endian. Defaults to wk_platform_endian() (slightly faster).

buffer_size

For WKB writing, the initial buffer size to use for each feature, in bytes. This will be extended when needed, but if you are calling this repeatedly with huge geometries, setting this value to a larger number may result in less copying.

feature_id, ring_id

Vectors for which a change in sequential values indicates a new feature or ring. Use factor() to convert from a character vector.

Value

*_translate_wkt() returns a character vector of well-known text; *_translate_wkb() returns a list of raw vectors, and *_translate_wksxp() returns an unclassed list of wksxp() geometries.

Examples

Run this code
# NOT RUN {
coords_point_translate_wkt(1:3, 2:4)
coords_linestring_translate_wkt(1:5, 2:6, feature_id = c(1, 1, 1, 2, 2))
coords_polygon_translate_wkt(c(0, 10, 0), c(0, 0, 10))

# }

Run the code above in your browser using DataCamp Workspace