This is awesome, @milos-makes-maps! Thanks for the tutorial. Can GAMD boundary files be loaded in R through a function such as giscoR()? I'd like to try out how the map looks with those boundaries instead of the ones from the GISCO database.
@milos-makes-maps8 ай бұрын
Thanks! You can use geodata package, which has a function called gadm. Using this you can access administrative subnational levels for any country in the world
@emanuelagu53928 ай бұрын
Thanks, Milos! I'll try this command. I've been manually downloading the GADM shapefiles so far, but I rather prefer to load the files (either as shapefiles or geopackages).
@lbarq11 ай бұрын
Thank you for this amazing tutorial. Always learning from you.
@milos-makes-maps11 ай бұрын
Thank you for your kind words, Luis! I'm happy that my tutorials help you learn!
@bkenminator8 ай бұрын
I've tried a few of your tutorials recently and have found them to be excellent and easy to adapt for other countries/regions. I'm wondering whether you would be able to explain how the get_categories function doesn't throw an error when you feed its results into as.factor() method? When I call get_categories(pop_change) it gives me a spatial raster object which as.factor won't accept. Thanks!
@GOATMENTATOR11 ай бұрын
All I have ever coded is two pretty basic graphs in R. Let's see if I can manage to replicate this for my country based on your video :D
@GOATMENTATOR11 ай бұрын
Ok I did it, but I am going to be honest - there is no art in copying your code without understanding pretty much anything :D
@milos-makes-maps11 ай бұрын
Hahaha, I'll take it as a compliment! Well done, btw
@rparis72911 ай бұрын
Thanks for the tutorial, really nice and clear! I would just make a remark, aren't the uninhabited places actually places without changes? I mean, it can be inhabited but if there were no pop changes the result would be also 0... anyway, just conceptual, and not really related to the tutorial itself... thanks again
@milos-makes-maps11 ай бұрын
That's a great point and it definitely makes sense to also label them "places without population change"
@emanuelagu53928 ай бұрын
Hi @milos-makes-maps, I'm using your script to draw the map for the US. What projection and/or rearrangement for Alaska and Hawaii would you suggest using in this case? Without using Lambert, the ggsave() ends in error because the US map exceeds 50 inches (and getting rid of the width and height parameters, or using limitsize = FALSE yields a map with disproportionate and dislocated title size). Thank you!
@emanuelagu53928 ай бұрын
I have made some changes to your script to generate a map of the United States. The map has been successfully generated, but I need to adjust the projection in the shapefile to move Alaska and Hawaii to the southwest corner. Can you guide me on how to do this using the same shapefiles that you use for the European Union maps? Thank you.
@brianmccormick838410 ай бұрын
wonderful stuff thank you. Now, to work out how to export it as a shapefile!
@milos-makes-maps10 ай бұрын
Hey Brian, you made a really nice map of the population change for Germany 👏🏻. Thanks for sharing it on X! Do you mean to transform the population change raster into a shape file?
@emanuelagu53928 ай бұрын
Hi @milos-makes-maps, I still need help adjusting the projection for countries whose territories extend over several meridians and parallels (mostly because their territories include islands), such as France, Spain, Portugal, and the US. The maps for those countries end up being distorted. Any hint will be welcomed! Thanks.
@andreidoanca426211 ай бұрын
cool tutorial
@milos-makes-maps11 ай бұрын
Thanks! Glad you enjoyed it!
@IrakliKavtaradzepsyche9 ай бұрын
DO you think it's possible to create a base map layer, then overlay population density layer and turn the second (density) layer into 3D with ray shader but keeping base map layer 2D at the same time?
@milos-makes-maps9 ай бұрын
That sounds like a great idea for another tutorial 😃
@IrakliKavtaradzepsyche9 ай бұрын
@@milos-makes-maps I hit the deadens while searching it and I don't think it's possible in ray shader but I'll be happy to be wrong ))
@samuelbrown963410 ай бұрын
can you please help with this error " w h
@milos-makes-maps10 ай бұрын
Hey, this means that pop_change_cats object wasn't created in the first place. Can you traceback to see why?
@samuelbrown963410 ай бұрын
Yes I have severally, I even copied the code on github and pasted into the console, I had the same output, I don't know what I'm missing.
@samuelbrown963410 ай бұрын
I'm using the R console
@milos-makes-maps10 ай бұрын
@@samuelbrown9634 what happens when you run this line: pop_change_cats as.factor()
@RioReads9 ай бұрын
Can we make such maps for a predicted population of a plant species?
@milos-makes-maps9 ай бұрын
Does the format of the data correspond to the population data?
@RioReads9 ай бұрын
@@milos-makes-maps As a result after running the model, you get a .tif file indicating the predicted species population in a region. Can I connect with you on a better platform for some details like mail or something?
@JorgeFilipeITV5 ай бұрын
> country_pop_rasters
@milos-makes-maps5 ай бұрын
It seems like you're encountering an error with the `terra::crop()` function in R, which suggests that the extents of the raster (`pop_rasters`) and the vector (`country`) do not overlap. This is required for the crop operation to work correctly. Here's how you can troubleshoot this issue: 1. Check Projections: Ensure that both the raster and vector data have the same coordinate reference system (CRS). You can use `terra::crs(pop_rasters)` and `terra::crs(country)` to check the CRS of both datasets. 2. Examine Extents: Compare the extents of the raster and vector data using `terra::ext(pop_rasters)` and `terra::ext(country)`. They must overlap for the crop to succeed. 3. Transform if Necessary: If the CRS differs, you may need to transform one of the datasets to match the other using `terra::project()`.
@reksakridawasesa43508 ай бұрын
Hi Milos, I've had this error: > get_country_borders country_pop_rasters
@bkenminator8 ай бұрын
The first one might be caused by using the wrong code - I think the ISO code for Bangladesh is just "BD". That may also solve your second issue of the CRSs not lining up. If not, you can go through and check the CRS of the country vector and those of the rasters and reset them accordingly prior to cropping.
@milos-makes-maps8 ай бұрын
I managed to get the country boundaries using your code, but can you show us the contents of pop_rasters file?