[R-sig-Geo] Calculate areas of multiple polygones within multiple polygones
basile.lenormand
b@@||e@|enorm@nd @end|ng |rom protonm@||@com
Mon Dec 20 12:44:45 CET 2021
Hello every one!
I am trying to compute the area of buildings inside neighbourhoods. I have a shapefile with the buildings and one with the neighbourhoods. I want to know the built-up area per neighbourhood but I do not understand how to procede.
I already compute the areas of each neighbourhood and I reach to attribute at each neighbourhood the buildings which are within. I created a field "batcount" in the neighbourhoods shapefile.
However I do not have the geometries of the buildings in this shapefile and I do not know how to procede in order to find the area of the buildings in each neighbourhood.
Here is the code I used to join the two shapefiles in order to count the number of buildings in each neighbourhood.
bat_count_iris <- st_join(bat, neighbourhoods) %>%
st_set_geometry(NULL) %>%
group_by(CODE_NEIGHBOURHOOD) %>%
tally() %>%
select(CODE_NEIGHBOURHOOD, batcount = n)
bat_in_iris <- left_join(CODE_NEIGHBOURHOOD, bat_count_iris, by = 'CODE_NEIGHBOURHOOD') %>%
mutate(batcount = ifelse(is.na(batcount), 0, batcount))
Do you have any clue of how I can compute the areas of the buildings in each neighbourhood?
Have a great day,
Basile.
Sent with [ProtonMail](https://protonmail.com) Secure Email.
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list