Skip to contents

Write geojson to disk

Usage

geo_write(x, file)

Arguments

x

input, an object of class geojson

file

(character) a file path, or connection

Details

Wrapper around jsonlite::toJSON() and cat

Examples

file <- tempfile(fileext = ".geojson")
geo_write(
  point('{ "type": "Point", "coordinates": [100.0, 0.0] }'),
  file
)
readLines(file)
#> [1] "{"                           "  \"type\": \"Point\","     
#> [3] "  \"coordinates\": [100, 0]" "} "                         
unlink(file)