Return Well-known Text representation of simple feature geometry or coordinate reference system

# S3 method for crs
st_as_text(x, ..., pretty = FALSE)

st_as_text(x, ...)

# S3 method for sfg
st_as_text(x, ...)

# S3 method for sfc
st_as_text(x, ..., EWKT = FALSE)

Arguments

x

object of class sfg, sfc or crs

...

modifiers; in particular digits can be passed to control the number of digits used

pretty

logical; if TRUE, print human-readable well-known-text representation of a coordinate reference system

EWKT

logical; if TRUE, print SRID=xxx; before the WKT string if epsg is available

Details

The returned WKT representation of simple feature geometry conforms to the simple features access specification and extensions, known as EWKT, supported by PostGIS and other simple features implementations for addition of SRID to a WKT string.

Examples

st_as_text(st_point(1:2))
#> [1] "POINT (1 2)"
st_as_text(st_sfc(st_point(c(-90,40)), crs = 4326), EWKT = TRUE)
#> [1] "SRID=4326;POINT (-90 40)"