View source: R/topojson_read.R
topojson_read | R Documentation |
Read topojson from a local file or a URL
topojson_read(x, ...)
x |
Path to a local file or a URL. |
... |
Further args passed on to |
Returns a sf
class, but you can easily and quickly get
this to geojson, see examples.
Note that this does not give you Topojson, but gives you a sf
class - which you can use then to turn it into geojson as a list or json
an object of class sf
/data.frame
geojson_read()
, topojson_write()
## Not run:
# From a file
file <- system.file("examples", "us_states.topojson", package = "geojsonio")
topojson_read(file)
# From a URL
url <- "https://raw.githubusercontent.com/shawnbot/d3-cartogram/master/data/us-states.topojson"
topojson_read(url)
# Use as.location first if you want
topojson_read(as.location(file))
# quickly convert to geojson as a list
file <- system.file("examples", "us_states.topojson", package = "geojsonio")
tmp <- topojson_read(file)
geojson_list(tmp)
geojson_json(tmp)
# pass on args
topojson_read(file, quiet = TRUE)
topojson_read(file, stringsAsFactors = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.