1 2 3 4 5
object of class
numeric, or object of class
precision is a
units object, the object on which we set precision must have a coordinate reference system with compatible distance units.
precision has no direct effect on coordinates of geometries, but merely set an attribute tag to an
sfc object. The effect takes place in st_as_binary or, more precise, in the C++ function
CPL_write_wkb, where simple feature geometries are being serialized to well-known-binary (WKB). This happens always when routines are called in GEOS library (geometrical operations or predicates), for writing geometries using st_write or write_sf,
st_make_valid in package
lwgeom; also aggregate and summarise by default union geometries, which calls a GEOS library function. Routines in these libraries receive rounded coordinates, and possibly return results based on them. st_as_binary contains an example of a roundtrip of
sfc geometries through WKB, in order to see the rounding happening to R data.
The reason to support precision is that geometrical operations in GEOS or liblwgeom may work better at reduced precision. For writing data from R to external resources it is harder to think of a good reason to limiting precision.
st_as_binary for an explanation of what setting precision does, and the examples therein.
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.