I am trying to learn how to use Mapbox Studio, but I can't figure out how to upload GeoJSON files that I export from R's sf package using the st_write()
function. For example, see the R code below:
library(tigris)
states <- states()
states <- st_transform(states, crs = "EPSG:3857")
st_write(states, "states.geojson")
When I load the exported states.geojson file into Mapbox Studio, I get the following error:
When loading other datasets I had created and exported as GeoJSON, I got a different error - "Error calculating min/max zoom: Bounds invalid".
I am new to Mapbox and GeoJSON so don't know much about this - but I would like to be able to export GeoJSON files from R using st_write()
and load them into Mapbox! Any insights on why I am getting these errors and how to avoid them would be much appreciated. Thanks.