The sf
package cannot read geojson natively. However, there is a package called geojsonsf
that reads geojson into data that you can work with in sf
.
Obviously I don’t have your geojson file to work with, but the package itself comes with some sample data so that I can show you the principle:
install.packages("geojsonsf")
library(geojsonsf)
library(ggplot2)
geo <- geojson_sf("C:/R/R-3.6.2/library/geojsonsf/examples/geo_melbourne.geojson")
ggplot(geo) + geom_sf(aes(fill = SA2_NAME)) + guides(fill = guide_none())
CLICK HERE to find out more related problems solutions.