file <- system.file("examples/test.pb", package = "geojson")
(json <- from_geobuf(file))
from_geobuf(file, pretty = TRUE)
pb <- to_geobuf(json)
f <- tempfile(fileext = ".pb")
to_geobuf(json, f)
from_geobuf(f)
object.size(json)
object.size(pb)
file.info(file)$size
file.info(f)$size
file <- system.file("examples/featurecollection1.geojson",
package = "geojson")
json <- paste0(readLines(file), collapse = "")
to_geobuf(json)
# other geojson class objects
x <- '{ "type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
]
}'
(y <- polygon(x))
to_geobuf(y)
x <- '{"type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }'
(y <- multipoint(x))
to_geobuf(y)
Run the code above in your browser using DataLab