Skip to content

3D models of places in the UK created with rayshader

Notifications You must be signed in to change notification settings

stefan-stein/3D_models_UK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

3D_models_UK

3D models of places in the UK created with rayshader R package.

Resources

For installation instructions see here. Follow this very extensive tutorial or browse the rayshader website to learn more about creating 3D plots in R.

For UK related lidar data, there is a very good, publicly available resource here. The data used for the examples in this repository comes from there. Which exact tiles were used is described in the R scripts.

Turning asc files into matrices usable by rayshader

The resource above will give you a bunch of asc files that need to be turned into a matrix that can be plotted by rayshader. This is achieved using the code below. Assuming you placed all the asc files into your working directory, run

raster_layers <- tibble(filename = list.files(path = getwd(),"*.asc$")) %>%
  mutate(raster =
           map(filename, .f = ~raster::raster(rgdal::readGDAL(.)))
  ) %>%
  pull(raster)
# Combine raster layers
raster_layers$fun <- mean
raster_mosaic <- do.call(raster::mosaic, raster_layers)
plottable_matrix <- raster_mosaic%>%
  raster_to_matrix()%>%
  reduce_matrix_size(0.5)

The last line reduce_matrix_size is not necessarily needed, but depending on the size of your matrix you probably will want to run it to save some resources.

Example

Warwick University Campus with labelled points of interest.

About

3D models of places in the UK created with rayshader

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages