matthew-law / 30DayMapChallenge2021

3 stars 0 forks source link

Question on script #1

Open cbeek-r7 opened 1 year ago

cbeek-r7 commented 1 year ago

As an absolute newbie on this area - I love your 3D map of DT and spinning - when I change the Lat/Long let's say for Mount Hood in Oregon, I do get all kinds of errors. Can you point me out where in the script I need to look for and change when I use other coordinates/locations please?

Appreciate your guidance/help,

C.

matthew-law commented 1 year ago

Hey Christiaan – I've had a look and I was able to make a similar visualisation for Mount Hood using the following code – I've simplified it a bit from my original DT script:

# devtools lets us install packages from GitHub
install.packages("devtools")
# install the rayshader package from GitHub
devtools::install_github("tylermorganwall/rayshader")
# install the rayvista package from GitHub
devtools::install_github("h-a-graham/rayvista", dependencies=TRUE)

# load all the packages needed
library(sf)
library(rayshader)
library(rayvista)
library(terrainr)

# Mount Hood coordinates:
# 45.3736, -121.6958

# plot via plot_3d_vista() function from rayvista
mount_hood <- plot_3d_vista(lat = 45.3736, long = -121.6958, zscale = 3,
                            overlay_detail = 16, windowsize = 800, zoom = 0.8, 
                            theta = 240, phi = 25, solid = F)

# if you want to clear the plot:
# rgl::rgl.clear()

# render a video and save it locally as MH_movie.mp4
render_movie('MH_movie', type = 'orbit', frames = 720, fps = 30, vignette = c(0.7, 0.5))

The movie it produces: https://user-images.githubusercontent.com/18603830/209433193-6fbea955-1585-41d3-8934-7d5c1c4cd9b4.mp4

You'll probably want to play with the parameters in plot_3d_vista()

cbeek-r7 commented 1 year ago

Many thanks for your reply and explanations - really appreciate it!!