# NOT RUN {
#Plotting the Monterey Bay dataset with bathymetry data
# }
# NOT RUN {
water_palette = colorRampPalette(c("darkblue", "dodgerblue", "lightblue"))(200)
bathy_hs = height_shade(montereybay, texture = water_palette)
#Set everything below 0m to water palette
montereybay %>%
sphere_shade(zscale=10) %>%
add_overlay(generate_altitude_overlay(bathy_hs, montereybay, 0, 0)) %>%
add_shadow(ray_shade(montereybay,zscale=50),0.3) %>%
plot_map()
#Correcting the aspect ratio for the latitude of Monterey Bay
extent_mb = attr(montereybay,"extent")
mean_latitude = mean(c(extent_mb@ymax,extent_mb@ymin))
montereybay %>%
sphere_shade(zscale=10) %>%
add_overlay(generate_altitude_overlay(bathy_hs, montereybay, 0, 0)) %>%
add_shadow(ray_shade(montereybay,zscale=50),0.3) %>%
plot_map(asp = 1/cospi(mean_latitude/180))
# }
Run the code above in your browser using DataLab