Monday, 7 October 2013

Refugee Camp Spatial Analysis

Zaatari Refugee camp was established in 2012 to host Syrian refugees fleeing the fighting in the Syrian civil war [Wikipedia]. After a tweet and a blog post from Lillian Pierson I thought I'd see what data was around.

The UNOSAT web site has shelter locations in the camp,as a shapefile, but I also had a look at OpenStreetMap to see what was there. As well as shelter locations, it also has locations of other facilities such as toilets, kitchens, mosques etc.

So for starters I thought a simple kernel density estimate of shelters might be something to do. The plan was to get the OSM data using the R package osmar, then create a 2d smoothing, then write that as a raster and map it in QGIS. Here's the R code:

# need these packages:
require(osmar)
require(KernSmooth)
require(raster)
# define the source for OSM data
api = osmsource_api()
# define the area and get the data
box=corner_bbox(36.310,32.281,36.338,32.303)
camp=get_osm(box,source=api)

# subset the shelters - first find shelter ids:
shelters=find(camp,node(tags(v == "shelter")))
# then subset:
shelters=subset(camp,node_ids=shelters)

# convert to spatial object for kernel smoothing
sh=as_sp(shelters)
# set bandwidth by trial and error
k1 = bkde2D(coordinates(sh$points),bandwidth=0.0002,gridsize=c(200,200))
# convert to raster
rsh = raster(list(x=k1$x1,y=k1$x2,z=k1$fhat))
# set CRS to lat-long
projection(rsh)=CRS("+init=epsg:4326")
# write a GeoTIFF file
writeRaster(rsh,"shelters.0002.tiff","GTiff")

With that done, you can load the tiff into QGIS and plot it over OSM basemap data. Stick that in a Map Composition and get this:

Obviously there's some problems with this - I should probably convert everything to a proper cartesian coordinate system so the units can be in people per square meter rather than people per square degree (which varies by latitude...), but this was a quick analysis on a Monday morning. The bounding box is also a bit small on the left and the top, the bandwidth was chosen to make the map look good and so on.

I'm not sure this analysis in itself is any practical use. I don't know how much GIS analysis the camp management are using, but this illustrates what can be done with open data and free and open source software. Anyone can do this.

Next steps might be to see how shelters relate to facilities, which is a first step to planning new facilities and is a classic GIS problem. With Zaatari becoming one of the largest settlements in Jordan, there is clearly a need for expansion planning in the camp.