Read and write well-known text

geos_read_wkt(wkt, crs = NULL)

geos_write_wkt(geom, include_z = TRUE, precision = 16, trim = TRUE)

geos_read_geojson(wkt, crs = NULL)

geos_write_geojson(geom, indent = -1)

geos_read_wkb(wkb, crs = NULL)

geos_write_wkb(
  geom,
  include_z = TRUE,
  include_srid = FALSE,
  endian = 1,
  flavor = c("extended", "iso")
)

geos_read_hex(hex, crs = NULL)

geos_write_hex(
  geom,
  include_z = TRUE,
  include_srid = FALSE,
  endian = 1,
  flavor = c("extended", "iso")
)

geos_read_xy(point)

geos_write_xy(geom)

Arguments

wkt

a character() vector of well-known text

crs

An object that can be interpreted as a CRS

geom

A GEOS geometry vector

include_z, include_srid

Include the values of the Z and M coordinates and/or SRID in the output? Use FALSE to omit, TRUE to include, or NA to include only if present. Note that using TRUE may result in an error if there is no value present in the original.

precision

The number of significant digits to include iin WKT output.

trim

Trim unnecessary zeroes in the output?

indent

The number of spaces to use when indenting a formatted version of the output. Use -1 to indicate no formatting.

wkb

A list() of raw() vectors (or NULL representing an NA value).

endian

0 for big endian or 1 for little endian.

flavor

One of "extended" (i.e., EWKB) or "iso".

hex

A hexidecimal representation of well-known binary

point

A list() representing points in the form list(x, y).

Examples

geos_read_wkt("POINT (30 10)")
#> <geos_geometry[1]>
#> [1] <POINT (30 10)>
geos_write_wkt(geos_read_wkt("POINT (30 10)"))
#> [1] "POINT (30 10)"