I have blocks of census data (shapefile with the column of interest being pop20) and polygons of areas of interest (shapefile with the column of interest being site). I am trying to get a sum of the population within each of the areas of interest (see example of one area of interest and the census blocks below). I don't know how to join the population estimates (column: pop20) to the areas of interest and account for polygons that are only partially within the areas of interest.

Hence I am interested in the following:

  1. what is the population within each census block within each area of interest, accounting for some blocks only being partial inside (so if 1/2 the block is within the area of interest, assume the population is 1/2 of the value in pop20).
  2. Then what is the sum of all the blocks within the area of interest weighing the blocks that are only partially within the area of interest from part 1.

area of interest in blue and census blocks in pink with grey boarders

I have essentially imported by shapefiles using the sf package but then I don't know what to do (do I use st_intersection or st_join or something else)?

pop<-st_read("...\\pop_census2020_prj.shp") buff<-st_read("...\\trap_mcpbuff_prj.shp") 

Thank you for your help.

1

Related questions 8 Combining polygons and calculating their area (i.e. number of cells) in R 0 Mean aggregation in R (Polygon in Polygon) 9 Calculating weighted polygon centroids in R Related questions 8 Combining polygons and calculating their area (i.e. number of cells) in R 0 Mean aggregation in R (Polygon in Polygon) 9 Calculating weighted polygon centroids in R 1 R: Calculating overlap polygon area 1 Summing values of attributes of overlapping polygons in SpatialPolygonsDataFrame with R 1 How can I extract an area weighted sum from a raster into a polygon in R? 2 How to calculate a weighted sum in R? 2 R: Calculate sum of polygon area or mean raster pixel value weighted by a non-linear function around geographic points 3 Surface Area Weighted Spatial Join of Polygons 0 calculating weighted sum of two columns with weights as two other columns Load 7 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.