geometrycollection: geometrycollection class

View source: R/geometrycollection.R

geometrycollectionR Documentation

geometrycollection class

Description

geometrycollection class

Usage

geometrycollection(x)

Arguments

x

input

Examples

x <- '{
 "type": "GeometryCollection",
 "geometries": [
   {
     "type": "Point",
     "coordinates": [100.0, 0.0]
   },
   {
     "type": "LineString",
     "coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
   }
  ]
}'
(y <- geometrycollection(x))
geo_type(y)
geo_pretty(y)
geo_write(y, f <- tempfile(fileext = ".geojson"))
jsonlite::fromJSON(f, FALSE)
unlink(f)

# bigger geometrycollection
file <- system.file("examples", "geometrycollection1.geojson", package = "geojson")
(y <- geometrycollection(paste0(readLines(file), collapse="")))
geo_type(y)
geo_pretty(y)

ropenscilabs/geojson documentation built on Aug. 23, 2023, 7:51 p.m.