Mapping uninhabited areas with R
ฝัง
- เผยแพร่เมื่อ 23 ก.ค. 2024
- In this tutorial, I will show you how to use the Global Human Settlement Layer (GHSL) data to map uninhabited areas for any place on planet Earth with R, terra, and ggplot2.
0:00 Prologue
01:10 Intro
01:44 Load libraries
03:46 GHSL data
05:35 Download GHSL data
06:43 Load GHSL data
07:55 Australia shapefile
09:13 Crop GHSL with Australia shapefile
10:12 Australia raster to dataframe
10:59 Inspect dataframe
11:29 Change column name
13:22 Map uninhabited areas
20:31 Final map
20:50 Closing
Check the full code in my GitHub repo:
github.com/milos-agathon/map-...
Follow my work on Instagram:
/ milos_makes_maps
Let's connect on Twitter:
/ milos_agathon
If you like my work, consider buying me a coffee:
www.buymeacoffee.com/milospop...
Music credits:
---------------------------------
"Danlsan - Darling" is under a Free To Use on TH-cam license
Music promoted by BreakingCopyright: bit.ly/b-darling
Another banger tutorial!
Thank you, I'm happy you like it! ☺️
Excellent tutorial with a fascinating dataset!
Thank you for your kind words. I'm happy you enjoyed the tutorial and found the dataset fascinating. I appreciate your feedback and support. I’m always looking for new ideas and challenges for future tutorials. If you have any topics or datasets that you would like me to explore, please let me know. I’m open to suggestions. Happy coding!
Was waiting for this 😍😍
Awesome! It's finally here! Enjoy!
Excellent! Definetly going to try this.
Thank you for your support and enthusiasm, Victor. It motivates me to create more tutorials like this. If you have any suggestions or requests for future topics, please let me know. I’m always open to new ideas and challenges. 😊
Excellent, my GIS skills are getting better & truly standing on the shoulders of giants(Milos) makes a big difference
my internet connection was a bit slow this morning so my connection was timing out. I have to put this line of code options(timeout = max(600, getOption("timeout"))) before the download.file() method.
I'm happy that you resolved the issue!
Thank you for your amazing comment. I'm honored that you consider me a giant in this field. I’m curious to see your final map!
Simply awesome and super easy. I made it for Pakistan to get it insight. I hope you ll not mind for using your codes. Thanks
Thank you for your kind words! Not at all, this tutorial and its code are meant for R enthusiasts like you
this is great!
Thanks! I hope it helps you!
Great. Thank you alot.
My pleasure!
😮 Neat
Thanks! 😁
¡Great!
Glad you like it!
waiting for new tutorial😊😊😊😊
Very soon :)
@@milos-makes-maps 😇😇
Hello Milos, I would like to thank you for your tutorials for I have learnt a lot from them. but how can I calculate such area?
Thank you! You can calculate the area size of uninhabited areas using terra package. First, filter only raster values that are equal to 0. Let's say your original raster file is called ras. Then you should run: ras_new 0, NA, ras). Second, compute the area size of each cell in square kilometers
ras_new_area
What a wonderful tutorial. I look forward to exploring your others. I have a question I suspect there is an easy answer to, but I am stuck. I used your tutorial and code as template, and attempted to make a similar uninhabited areas map for Argentina. However, when I view the output the country appears very distorted (stretched horizontally). I can confirm that both the Spat Raster object and the country border vector are in the same projection (WGS 84), so I do not *think* it is a projection issue. But what I see is definitely not how Argentina appears on WGS84-projected maps...
Thanks!
Thank you for your kind words! I suspect that the map of Argentina is stretched because WGS84 is not great with areas closer to the poles. Do you know what is the standard coordinate reference system for Argentina?
@@milos-makes-maps Thanks for replying. I have tried to reproject the raster into a more appropriate projection, bu still it looks very distorted 😕 I would love to understand where I am going wrong. Here is what I did after the point of creating the get_country_borders() function:
country
@@camsnouse Ah I see what you mean. I think that you'll get a better result if you use the South America Equidistant Conic projection:
+proj=eqdc +lat_0=-32 +lon_0=-60 +lat_1=-5 +lat_2=-42 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs
Hello! I am from Argentina. Query: where did you get the source of population data by area? from INDEC? of the 2010 or 2022 census?
Hello, it's all explained in the video: Global Human Settlement data
@@milos-makes-maps I will consult Global Human Settlement data, which is the source of data collection, because I believe that the only official statistics organization in Argentina is the INDEC, which carries out the population census. Thank you. Greetings
sir ,in here i have a question .how do you say 0(value) is inhabitant(no settlements).what is indicated by value column .because all the process is based on this. if it is grateful ,you can say concise answer.
Hello, the value column shows the estimated number of people, according to GHSL. That's why we compute the presence of uninhabited areas based on this column
@@milos-makes-maps sir i got three different map of year 2000,2010 and 2020.but all map are same in detailed .i am confusing about that
@@sandunpriyankarasomarathna9281 There is data for 2020 and every five years preceding and succeeding it. Did you mean 2015, 2020 and 2025?
sir .I have a request, can you do the kind of map which show the atmospheric pollution in particular country in particular year .and how it change the across the country. Because this topic is very common in these days
Hello, I've created one on CO2 emissions but it's not about making a time lapse map so I might make one on animating air pollution. Thank you for the idea!
@@milos-makes-maps thank you sir
sir,i am doing gis project using r programing.i have to face some technical issues some are solved .can i cantact you through email to find out some solutions for that
Hi, I’m sorry to hear that you have some technical issues with your project. The best way would be to open a GitHub repo and store your working code there, and send me an email with a description of what you want to achieve and the link to the repo. This would be the best mode of collaboration for me
@@milos-makes-maps okay sir.i will do that