library(rayshader)
library(tidyverse)
<- bomrang::get_available_imagery() %>%
files ::str_subset("202111100700")
stringr
::curl_download("ftp://ftp.bom.gov.au/anon/gen/gms/IDE00427.202111110800.tif",
curl"IDE00427.202111110800.tif")
=raster::raster("day11_3D/IDE00427.202111110800.tif")
localtif
#And convert it to a matrix:
= rayshader::raster_to_matrix(localtif)
elmat
require(rayshader)
#We use another one of rayshader's built-in textures:
<- elmat %>%
earth1 sphere_shade(colorintensity = 2,
zscale = 1/2,
texture="unicorn") %>%
plot_map()
# save plot
::agg_png(here::here("day11_3D/3D.png"),
raggres = 320, width = 12, height = 8, units = "in")
%>%
elmat sphere_shade(colorintensity = 2,
zscale = 1/2,
texture="unicorn") %>%
plot_map()
dev.off()
# fonts
library(showtext)
library(extrafont)
#fonts()
#loadfonts()
font_add_google("Shadows Into Light","ShadowsIntoLight")
showtext_opts(dpi = 320)
showtext_auto(enable = T)
# final touches
library(cowplot)
library(magick)
<- magick::image_read(here::here("day11_3D/3D.png"))
image_3D
<- cowplot::ggdraw()+
final draw_image(image_3D,x = 0.1, y = 0,width = 0.7) +
draw_label(label="Australia perspective",x=0.3,y=0.15,
fontfamily="ShadowsIntoLight",size=20) +
draw_label(label="World 3D Sat-view (8am 11.11.2021-GMT+11)", x=0.45, y=0.9,
size=30,
fontfamily="ShadowsIntoLight") +
draw_text("Datasource: bom.gov.au and #30DayMapChallenge day11 3D\nInfographics: Federica Gazzelloni",
x=0.5,y=0.05,family="ShadowsIntoLight",size=12)
::agg_png(here::here("day11_3D/world_3D.png"),
raggres = 320, width = 8, height = 6, units = "in")
finaldev.off()
Overview
The data for this World 3D map
is a Sat-view
(8am 11.11.2021-GMT+11), data is from bom.gov.au
and the {bomrang}
package.
source: https://ggplot2-book.org/maps.html