TransWikia.com

Extract into a dataframe the number of points in each buffer, in a set of concentric equi-distance buffers around a single point

Geographic Information Systems Asked by Seun Addie on April 27, 2021

I have the locations of the patients using an healthcare facility, and wants to extract the number of patients living at given distances from the hospital.
I generated buffers at 500m increments around the hospital, but not able to extract the number of patients in each buffer.
I was able to generate and plot the desired buffers, was also able to intersect with the patient locations, but was not able to get out the desired output.

suppressMessages(library(sf))
suppressMessages(library(tmap))
suppressMessages(library(maptools))
suppressMessages(library(rgeos))
suppressMessages(library(dplyr))

setwd("C:/SpatTemp/gwr_lg_data")
Lagos <- readShapePoly("Lagos_State_LGAs")
Lagos<- st_as_sf(Lagos, coords = c("Longitude", "Latitude"),
                 crs = "+proj=longlat +datum=WGS84")

setwd("C:/SpatTemp")
pract<- read.csv("First.csv")
pract_sf <- st_as_sf(pract, 
                     coords = c("Longitude", "Latitude"),
                     crs = "+proj=longlat +datum=WGS84")

hospt<-read.csv("Hospital.csv")
hospt_sf<- st_as_sf(hospt, 
                    coords = c("Longitude", "Latitude"),
                    crs = "+proj=longlat +datum=WGS84")

hospt_BNG<- st_transform(hospt_sf, 27700)
rad<- seq(25000,500, by=-500)

for (x in rad) {               
 plot(st_geometry(st_transform(st_buffer(hospt_BNG, x), 4326)))
              }
 
for (x in rad)  { 
        pract_sf %>% st_join(st_transform(st_buffer(hospt_BNG, x), 4326), ., left = FALSE) %>% 
              count(Address)
          }

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP