Skip to content

Commit

Permalink
cache
Browse files Browse the repository at this point in the history
  • Loading branch information
wlangera committed Dec 19, 2024
1 parent cc314b6 commit 2f32875
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions source/markdown/test_densiteitsmodellering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2099,14 +2099,21 @@ prediction_grid <- st_make_grid(
cellsize = units::set_units(300*300*pi, "m^2")
)
prediction_grid_sf <- st_sf(geometry = prediction_grid)
joined_grid <- st_join(prediction_grid_sf, dsm1_pred_sf, join = st_nearest_feature)
joined_grid <- st_join(prediction_grid_sf, dsm1_pred_sf,
join = st_nearest_feature)
cropped_grid <- qgisprocess::qgis_run_algorithm(
"native:intersection",
INPUT = joined_grid,
OVERLAY = flanders_sf
) %>%
st_as_sf()
if (file.exists(file.path(cache_dir, paste0("cropped_grid_dsm.Rds")))) {
cropped_grid <- readRDS(file.path(cache_dir, paste0("cropped_grid_dsm.Rds")))
} else {
cropped_grid <- qgisprocess::qgis_run_algorithm(
"native:intersection",
INPUT = joined_grid,
OVERLAY = flanders_sf
) %>%
st_as_sf()
saveRDS(cropped_grid, file.path(cache_dir, paste0("cropped_grid_dsm.Rds")))
}
```


Expand Down

0 comments on commit 2f32875

Please sign in to comment.