![3d us population density map 3d us population density map](https://www.vividmaps.com/wp-content/uploads/2018/08/US-density.jpg)
More information on that dataset can be found I also will use a file with an accuracy of 1 km x 1 km Grid provided by the European Commission Science Hub, called the Global Human Settlement Layer (GHSL) and specifically the GHS-POP dataset (“This spatial raster dataset depicts the distribution of population, expressed as the number of people per cell."). For this blog, I will use the one file with an accuracy of 100m from AfriPop, with as the unit of measurement the “Estimated persons per grid square” (for more information and to download the data see: ). The more precise the resolution, the more granular the data (and the larger the data file). Most of these population density files will be in a raster format file (usually a GeoTIFF) and have a certain resolution (e.g. Some are based on countries censuses, some on satellite data, and some on a combination of these two. There are many different sources of population data available online. Library(gdata) # to delete objects from the environment Library(scales) # to create nice scales in the legend Library(stringr) # to work with text data Library(rayrender) # to to render the 3D plot Library(leaflet) # to make the interactive versions of the map Library(SpatialPosition) # to calculate some spatial statistics Library(tmap) # to make the static 2d maps Library(tidyverse) # to do the data wrangling Library(rworldmap) # to get the shape file of Ghana
![3d us population density map 3d us population density map](https://www.geogebra.org/resource/jUrXhbeX/FR0HzrmtHYWpZpSn/material-jUrXhbeX.png)
Library(tanaka) # to make the Tanaka plots Library(cartography) # to help with the plotting of the maps library(raster) # to work with raster data These are the packages I use for this blog. In this tutorial, I will show to make 3d population density maps and animations using the rayshader package and how to create an insightful leaflet map from raster data.
![3d us population density map 3d us population density map](https://www.kontur.io/wp-content/uploads/2023/06/US_population_density_map-1024x666.jpg)
Browsing through Twitter I came across these pretty cool (albeit not very useful) 3D representations of population density in different places and I wondered if I could just do the same for Ghana (see If I find the energy I might come back to it and add some more text, but for now, I will let the images tell the story.īack to the origin. So this blog is a lot of code and relatively little text. Also, the code for this blog took me some real head-scratching and I probably discarded close to 20.000 lines of code along the way. This is mostly due to the fact that I do no longer have to work from home and because worked has really picked up again since Ghana lifted its travel restrictions and I could go back to work in person. It has been a while since I wrote a blog for this website.