Pecners / rayshader_portraits

GNU General Public License v3.0
522 stars 95 forks source link

s <- states() in illinois mapping #3

Closed Chuan1997 closed 1 year ago

Chuan1997 commented 1 year ago

Hi, there! I try to learn the details of coding a population map and when I run the illinois code, this error occured:

map <- "illinois"
data <- st_read(".../kontur_population_US_20220630.gpkg")
s <- states() |> st_transform(crs = st_crs(data))

_Retrieving data for the year 2021 |======================================================================================================================| 100% Error: Cannot open "C:\Users\xxx\AppData\Local\Temp\RtmpWcYtrq"; The source could be corrupt or not supported. See st_drivers() for a list of supported formats._

Any idea what happened? Much appreciated if you could help!

Pecners commented 1 year ago

Is your second line of code running without error? In other words, are you successfully reading in the Kontur data?

Chuan1997 commented 1 year ago

turns out I need to put options(tigris_use_cache = TRUE) in the beginning of the file, and the error is gone. And now the question is anyone locate outside the U.S. cannot use states() function to download, so I will try to use other countries to continue the learning of rayshader. Thanks!