Map city expansion with R like a PRO

preview_player
Показать описание
As the global city expansion rapidly turns our soil into asphalt and concrete, we often find ourselves as mere bystanders in the whole process.
In this tutorial, I show you how you can easily map the built-up expansion of Delhi in the last 20 years with R.

0:00 Intro
1:39 GLAD data
6:54 Load packages
7:44 Scrape GLAD website
8:48 Get Delhi coordinates
9:33 Retrieve GLAD data
11:12 Plot built-up raster
11:59 Loading two rasters
12:54 OpenStreetMap website
14:09 Get Delhi boundaries
15:10 Plot boundaries over raster
15:32 Crop method 1
16:43 Crop method 2
17:59 Crop method 3
20:37 Raster to data frame
22:02 Add roads
25:16 Clip roads
26:06 Mapping
31:20 Final map
31:55 Closing

Check the full code in my GitHub repo:

Follow my work on Instagram:

Let's connect on Twitter:

If you like my work, consider buying me a coffee:

Music credits go to:

"Pyrosion - Day In Paris" is under a Creative Commons (CC BY-SA 3.0) license
@pyrosionmusic8562
Рекомендации по теме
Комментарии
Автор

Amazing! Thank you too much. I learned a lot, and I manged to do it into Inhambane City, Mozambique. Hugs!

steliofranciscomatsinhe
Автор

Fantastic as usual. An exemplary way of presenting with clarity and quality. Thank you a lot.

mahatmaalimibrahim
Автор

Excellent stuff as always. Thanks again for making this content available.

lbarq
Автор

Hello, MIlos. This is a nice one. I have a question, there is a way to move the circle crop too the right? I want to center in another area of the city.

miguelhg
Автор

Thanks for the tutorial. But I am getting an error while loading the OSM data. Also please let me know how can we select smaller towns not cities.
Error in `httr2::req_perform()`:
! HTTP 405 Method Not Allowed.

sohom-
Автор

I don't seem to be getting boundaries for lagos
it's really frustrating as i don't know how where else to get help

No polygonal boundary for Abuja
abuja_border <- osmdata::getbb(
city,
format_out = "sf_polygon"
) |>
sf::st_set_crs(crsLONGLAT) |>
sf::st_transform(crsLONGLAT)

terra::plot(builtup_data)
plot(abuja_border, add = T)


Error in UseMethod("st_crs<-") :
no applicable method for 'st_crs<-' applied to an object of class "NULL"

victorjames
Автор

Sir, thank you so much for your excellent tutorial. I have one question. When I try to define longlat projection for the boundary of a specific area (in my case Yangon, Myanmar), I ge this error message: "Error in UseMethod("st_crs<-") :
no applicable method for 'st_crs<-' applied to an object of class "list"". So, how can I fix that?

MrAung-cxyr