R: sfc to GeoJSON

sfc_geojson {geojsonsf} | R Documentation

## sfc to GeoJSON

### Description

Converts 'sfc' objects to GeoJSON

### Usage

    sfc_geojson(sfc, digits = NULL)

### Arguments

`sfc` | simple feature collection object
`digits` | integer specifying the number of decimal places to round numeric coordinates. numeric values are coorced using `as.integer`, which may round-down the value you supply. Default is `NULL` - no rounding

### Value

vector of GeoJSON

### Examples

    ## Not run:
    library(sf)
    sf <- sf::st_sfc(list(sf::st_point(c(0,0)), sf::st_point(c(1,1))))
    sfc_geojson(sf)

    ## End(Not run)

[Package geojsonsf version 2.0.1 Index]