I am trying to create a list that is correctly formatted as topoJSON from an sf object.
What would work when reading a valid topoJSON file is:
sa <- jsonlite::read_json("https://raw.githubusercontent.com/pachadotdev/d3po/main/dev/south-america.topojson", simplifyVector = F)
What I am trying to do is:
# install_github("pachadotdev/canadamaps")
library(canadamaps)
library(sf)
library(geojsonio)
provinces <- get_provinces()
provinces <- st_as_sf(provinces)
geojson_write(provinces, file = "provinces.geojson")
provinces2 <- geojson_read("provinces.geojson")
geo2topo(provinces)
Error: no 'geo2topo' method for sftbl_dftbldata.frame
Is there any option to convert to topoJSON from R?
I tried saving as geoJSON and then re-exporting in QGIS, but it doesn't save as topoJSON.