Learn R Programming

lwgeom (version 0.2-14)

st_astext: Return Well-known Text representation of simple feature geometry

Description

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

Usage

st_astext(x, digits = options("digits"), ..., EWKT = FALSE)

st_asewkt(x, digits = options("digits"))

Arguments

x

object of class sfg, sfc, or sf

digits

integer; number of decimal digits to print

...

ignored

EWKT

logical; use PostGIS Enhanced WKT (includes srid)

Details

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

st_asewkt() returns the Well-Known Text (WKT) representation of the geometry with SRID meta data.

Examples

Run this code
library(sf)
pt <- st_sfc(st_point(c(1.0002,2.3030303)), crs = 4326)
st_astext(pt, 3)
st_asewkt(pt, 3)

Run the code above in your browser using DataLab