Convert bounds into raster in R

  Kiến thức lập trình

I have a data frame with quad keys and associated values for activity index, and I want to convert it into a raster. The quadkeyr package is too slow for the scale of my data (each hour across all of Canada), so I just want to use the terra package.

Here is a sample of the data:

structure(list(geography = c("021302200001103223", "021302200001123321", 
"021302200001111311", "021302200001110301", "021302200001100333", 
"021302200001111211"), xlon = c(-112.35512, -112.34962, -112.32491, 
-112.33864, -112.35786, -112.3304), xlat = c(50.72298, 50.70994, 
50.73254, 50.73254, 50.72994, 50.73254), bounds = c("-112.35580,50.72255,-112.35443,50.72342", 
"-112.35031,50.70950,-112.34894,50.71037", "-112.32559,50.73211,-112.32422,50.73298", 
"-112.33932,50.73211,-112.33795,50.73298", "-112.35855,50.72950,-112.35718,50.73037", 
"-112.33109,50.73211,-112.32971,50.73298"), start_date = c("2021-07-01", 
"2021-07-01", "2021-07-01", "2021-07-01", "2021-07-01", "2021-07-01"
), end_date = c("2021-07-31", "2021-07-31", "2021-07-31", "2021-07-31", 
"2021-07-31", "2021-07-31"), agg_day_period = c(0L, 0L, 1L, 1L, 
1L, 1L), agg_time_period = c(15L, 17L, 10L, 11L, 12L, 15L), activity_index_total = c(0.010026, 
0.034617, 0.02384, 0.051245, 0.023967, 0.027478)), row.names = c(NA, 
6L), class = "data.frame")

How can I convert this into a raster without using a dedicated quadkay package? I don’t have data on the original resolution but I have bounds in the data frame itself.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT