Background

This is document explaining the process for rasterising the locations of the hospitals (point shapefile) and road network (line shapefile). The sample raster used has a resolution of 100m X 100m. Later, the flood maps are re-sampled to this resolution when it is used for calculating the ‘conditional probability’ of these layers to floods.

For the work, we have to load the following libraries:

packages <- c("terra")
#read the line shape file of the road network
arterial_rd <- vect("state/phyinfr/arterial_rd.shp")
plot(arterial_rd, main = "road network to be rasterised")

#read the sample raster file whose dimentions and extents are used for rasterising the shapefile
pop <- rast(sprintf('state/pop_ind_ppp_%s_UNadj.tif',2015))
plot(pop, main = "sample raster")

#flood <- rast(sprintf("conditioningfactors/flood_prob_%sgrt0_005.tif",2015))
rd_sampl <- rast(nrow = nrow(pop), ncol = ncol(pop))
ext(rd_sampl) <- ext(pop)
res(rd_sampl) <- res(pop)
crs(rd_sampl) <- crs(pop)
#rasterise the shapefile
state_arterialrd <- rasterize(arterial_rd, rd_sampl, 'STATE_ID')
plot(state_arterialrd, main = "rasterised road network")

#save the raster image
writeRaster(state_arterialrd, "state/phyinfr/arterial_rd.tif", overwrite=TRUE)
#read the line shapefile of the location of hospitals
arterial_rd <- vect("state/phyinfr/medical_facilities_geosadak_assam.shp")
plot(arterial_rd, main = "hospital points to be rasterised")

#read the sample raster file whose dimentions and extents are used for rasterising the shapefile
pop <- rast(sprintf('state/pop_ind_ppp_%s_UNadj.tif',2015))
plot(pop, main = "sample raster")

#flood <- rast(sprintf("conditioningfactors/flood_prob_%sgrt0_005.tif",2015))
rd_sampl <- rast(nrow = nrow(pop), ncol = ncol(pop))
ext(rd_sampl) <- ext(pop)
res(rd_sampl) <- res(pop)
crs(rd_sampl) <- crs(pop)
#rasterise the shapefile
state_arterialrd <- rasterize(arterial_rd, rd_sampl, 'STATE_ID')
plot(state_arterialrd, main = "rasterised hospital locations")

#save the raster image
writeRaster(state_arterialrd, "state/phyinfr/hosptial_rd.tif", overwrite=TRUE)