## Not run:
# # From a file
# file <- system.file("examples", "california.geojson", package = "geojsonio")
# out <- geojson_read(file)
#
# # From a URL
# url <- "https://raw.githubusercontent.com/glynnbird/usstatesgeojson/master/california.geojson"
# geojson_read(url, method = "local")
#
# # Use as.location first if you want
# geojson_read(as.location(file))
#
# # use jsonlite to parse to data.frame structures where possible
# geojson_read(url, method = "local", parse = TRUE)
#
# # output a SpatialClass object
# ## read kml
# file <- system.file("examples", "norway_maple.kml", package = "geojsonio")
# geojson_read(as.location(file), what = "sp")
# ## read geojson
# file <- system.file("examples", "california.geojson", package = "geojsonio")
# geojson_read(as.location(file), what = "sp")
# ## read geojson from a url
# url <- "https://raw.githubusercontent.com/glynnbird/usstatesgeojson/master/california.geojson"
# geojson_read(url, what = "sp")
# ## read from a shape file
# file <- system.file("examples", "bison.zip", package = "geojsonio")
# dir <- tempdir()
# unzip(file, exdir = dir)
# shpfile <- list.files(dir, pattern = ".shp", full.names = TRUE)
# geojson_read(shpfile, what = "sp")
#
# # doesn't work right now
# ## file <- system.file("examples", "feature_collection.geojson", package = "geojsonio")
# ## geojson_read(file, what = "sp")
# ## End(Not run)
Run the code above in your browser using DataLab