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 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. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |