Archive | GIS RSS for this section

Mapmaking with ggmap

I am always looking for free alternatives to ArcGIS for making pretty maps. R is great for graphics and the new-to-me ggmap package is no exception.

I’m working with some data from Botswana for a contract and needed to plot maps for several years of count based data, where the GPS coordinates for facilities were known. ArcGIS is unwieldy for creating multiple maps of the same type of data based on time points, so R is an ideal choice…. the trouble is the maps I can easily make don’t look all that good (though with tweaking can be made to look better.)

ggmap offered me an easy solution. It downloads a topographic base map from Google and I can easily overlay proportionally sized points represent counts at various geo-located points. This is just a map of Botswanan health facilities (downloaded from Humanitarian Data Exchange) with the square of counts chosen from a normal distribution. The results are rather nice.

BotswanaHF

library(rgdal)
library(ggmap)
library(scales)

#read in grographic extent and boundary for bots
btw <- admin<-readOGR(“GIS Layers/Admin”,”BWA_adm2″) #from DIVA-GIS

# fortify bots boundary for ggplot
btw_df <- fortify(btw)

# get a basemap
btw_basemap <- get_map(location = “botswana”, zoom = 6)

# get the hf data
HFs.open.street.map<-read.csv(“BotswanaHealthFacilitiesOpenStreetMap.csv”)
# create random counts
HFs.open.street.map$Counts<-round((rnorm(112,mean=10,sd=5))^2,0)

# Plot this dog
plot
ggmap(btw_basemap) +
geom_polygon(data=btw_df, aes(x=long, y=lat, group=group), fill=”red”, alpha=0.1) +
geom_point(data=HFs.open.street.map, aes(x=X, y=Y, size=Counts, fill=Counts), shape=21, alpha=0.8) +
scale_size_continuous(range = c(2, 12), breaks=pretty_breaks(5)) +
scale_fill_distiller(breaks = pretty_breaks(5))

Advertisements

Kenya 2017 Election Violence: Some Data Analysis

I’m getting used to the new version of ArcGIS (which is a vast improvement!) and gave it a test run on some data from the ACLED (Armed Conflict Location & Event Data Project) database, specifically on this years round of violence surrounding the Kenyan election. ACLED keeps real time data on violence and conflict around the globe, the latest entry in 2017 is Nov 24, just five days ago.

KenyaViolence2017

The first election occurred on August 8th, 2017. The opposition contested the results of the election, claiming problems in vote tallying by the IEBC, resulting in a nullification by the Supreme Court. A new election was called and was to be conducted within 60 days of the nullification. Raila Odinga, the opposition leader, claimed that the election again would not be fair, dropped out of the race and called for a national boycott. The election went ahead as place on October 26, 2017 and Uhuru Kenyatta was declared the winner.

NairobiViolence

 

 

There was violence at every stage of the process, both by rioters in support of the opposition and by the police and military who were known to fire live rounds into groups of demonstrators. Opposition supporters were known to set fire to Kikuyu businesses. Local Kikuyu gangs were reported to be going house to house rooting out people from tribal groups from the West and beating them in the street. Tribal groups in rural areas were reported to be fighting amongst one another. The police response has been heavy handed and disproportionate leading to a national crisis.

As of now, though not nearly as violent as the post election violence of 2007-08, the violence has not yet abated.

In the database, there were 420 events logged, including rioting, protests and violence against civilians by the state, police and local tribal militias. There are 306 recorded fatalities in the data base, but this number should be approached with some caution. There were likely more. The database is compiled from newspaper reports, which don’t count fatalities and don’t cover all events.
ViolentTSI made two maps (above), one for Nairobi, and the other for Kenya. They include all non Al-Shabaab events (a Somali Islamist group the Kenya Defense Force has been fighting for several years.) I also included a time series of both events and fatalities.

Some excerpts from the notes:

“Police raided houses of civilians in Kisumu, beating civilians and injuring dozens. Live bullets were used on some civilians, including a 14 year old boy. Of the 29 people injured, 26 had suffered gun shots.”

“One man was found dead in a sugar cane plantation one day after ethnic tensions between the Luo and Kalenjin communities got into an ethnic clash. The body had been hacked with a panga.”

“Rioters started throwing stones at the police in the morning, protesting against the elections to be held the next day. The police responded with teargas and water canons. The rioters were mostly from the Luo ethnic group and they took the opportunity to loot several stores, attack residents and to burn a store owned by an ethnic Kikuyu. One woman was raped.” *This was in Kawangware, not far from my apartment. I was eating at a local bbq place when this happened. 

 

 

“Police forces attacked supporters of the opposition that went to the Lucky Summer neighbourhood to check on a ritual of beheading of a sheep that was taking place (suspectedly by the Mungiki sect). The police shot at the civilians. The police confirmed that it shot a man and that the group performing the ritual had sought protection.”

“As a revenge to the previous event, the Kikuyu joined forces and attacked the Luo. The ethnic tensions and violence led to one severely injured person. Residents claims three were killed and dozens, including three school children, were injured.”

Snake Bites in Kwale, Kenya: Into the Field

snakebitesWe just spent the day driving around Kwale looking for snakes, and/or people who had been bitten by snakes. As the last post showed, snakebites are a persistent problem along the Kenyan Coast, with more then 5% of the households we survey indicating that at least one person in the household had been bitten in the past two years.

It wasn’t difficult to find them.

Snakes are universally feared all over Africa and the associations with witchcraft make it a common topic of discussion. Everyone knows someone who has been bitten. They often know all the details, including where it happened and what occurred following the bite. It’s never a happy story.

We went deep into Kinango, an extremely rural area west of Kwale Town and found a friendly lady who seemed to know everything about everyone. She was incredibly jolly, pulled out some plastic chairs for us to sit under and cracked jokes the whole time. I even got to copy her collection of Sangeya music which she had recorded on her phone (another post but you can hear some of it here) at some local music festivals. In total I got more than five hours of live Sengeya and Chilewa music. In the music world, these would be called “field recordings.” Here, this is just music she cooks and cleans to.

Switching back and forth between snakes and Sengenya (in Africa it seems to be possible to have multiple conversations at once), she told us about a kid who had been bitten two days previous. She even told us where to find her, so off we went.

The child was collecting firewood around a mango tree near her home, when she was suddenly bitten by a large green snake, not once but three times on the foot. The snake bit once skated away, decided it wasn’t enough and came back and bit her twice more.

Ants had moved into the dead tree and hollowed out the area underneath. Presumably, the snake moved in previously and came out to warm up during the day.

The mother thankfully took the child immediately to Kinango Hospital and treated was administered. The child was given a three day course of antivenom injections and charcoal was wrapped around the wounds to absorb any venomous discharge. Though the child complains of some numbness in the area, it looks as if there won’t be any permanent damage. Thankfully.

OLYMPUS DIGITAL CAMERA

Snake bite (species unknown). Note the charcoal. Victim is a 10 year old girl.

We were also told of an old woman who had been bitten more than 20 years ago, and was badly scarred, figured out where she was and off we went again.

As we pulled up a friendly young lady came out to greet us, and showed us the way to the house out back. In the distance, we could see an old lady walking with a limp. Otherwise, she was completely fit and seemed to be cutting her own firewood with a panga.

She brought us out some chairs and sat down to chat. In 1992, she had been out back collecting firewood (a pattern) and was bitten on the foot by puff adder, one of the deadliest snakes in the world. She was bitten on the foot, and became immobile for nearly a week. A series of witch doctors were brought in, who administered charcoal rubbed into small cuts in the skin.

Necrosis set in, and watery blood erupted out of the wound site. A large number of maggots appeared. Finally, someone had the good sense to take her to the hospital, where she spent an entire year.

The details were unclear, but it appeared that the gangrene was so severe that multiple infections were presents. They likely had her on intravenous antibiotics for an extended amount of time. Despite this, the foot did not heal. Some Christian missionaries came, and convinced her to convert to Christianity, which, she claimed, improved her condition. This is likely coincidental.

OLYMPUS DIGITAL CAMERA

Puff Adder wound. Note the permanent curvature of the foot. She continues to have to wrap it and use topical medication, 24 years following the bite.

The doctors suggested a skin graft to improve the foot, but she refused. Necrosis was so deep that it permeated the bone and the foot is permanently curved as a result. The leg still shows sign of swelling even more than 24 years after the bite. In most cases, they probably would have simply amputated.

The lady was born in 1948, bore ten children, one of which was born just as she was bitten. She was unable to breast feed or care for the child. Regardless, the daughter has two children of her own now.

Snakebites are bad news. In this woman’s case, the disregard for proper medical care simply made a bad situation worse. She is truly lucky to be alive. If she had died, it is doubtful that the Mgangas would have admitted any responsibility.

OLYMPUS DIGITAL CAMERA

Puff Adder victim, born in 1948. Ten kids. Still going strong.

Terror in the Mid-East: It’s never been worse

TerrorWe are entering into one of the most chaotic chapters of modern history, though the geographic space of this chaos is smaller than it has ever been. While most countries are experiencing less terror, Mid-Eastern terrorist have never been busier or more successful.

I downloaded data from the Global Terrorism Database, which comprises more then 125,000 individual acts of terror and found that, since 2010, the number of weekly terror events when from somewhere around 10 to more than 40, and the trend doesn’t look like it’s ending anytime soon.

Moreover, while terror events are becoming more frequent, they are becoming more and more unpredictable.

While the world was shocked over Charlie Hebdoe, the troubling scale up in the number of terror events seems to have mostly gone unnoticed. Terrorists strike Islamic countries far more than they do France, and kill more than just cartoonists and policemen.

It is unproductive to view all terror groups and even acts of terror as being the same. Terror has turned into a morass of competing groups, with differing political aims and the loose nature of Al Qaeda has led to an outsourcing of terror by any local thug with a gun.

It is also unproductive to view Mid-East terror as simply restricted to the angry victims of drone attacks. Islamic terrorism has a deep history with roots going back decades, a history which seems to be widely ignored. It is also important to note that ISIS’ membership consists of a frighteningly large number of Westerners and a careful watch of their videos reveals that English, rather than Arabic, is a common language among its followers.

Where will this go? No one knows, but Charlie Hebdoe will be just a blip on the pattern on terror.

TerrorPlot

The issue of borders…

I was just reading this column in a special section of the NYT from Maano Ramutsindela, geographer from the University of Cape Town.

The partitioning of Africa by European empires has had devastating social, economic, political and psychological impacts, and millions of lives have been lost in post-independence Africa defending colonial borders. We are overdue for an African renaissance, completing the decolonization – which remains unfinished business until boundaries are changed.

His piece is mostly about the issue of parks, but the following came to mind.

1. Perhaps the author does not realize that millions of European lives have also been lost over the issue of borders. Historically, countries in Europe also haven’t fully represented linguistic groups (what is a language anyway?).

2. While from afar it may seem self evident to create states based on language, I’m wondering how that plays out in a country like Kenya, where there are more than 40 languages spoken and where, since often ethnic groups represent occupational groups, linguistic regions overlap. The distinctions between languages and cultures are often artificial anyway. Though the Maasai and the Samburu speak mutually intelligible languages and share almost identical cultural practices, they are bitter enemies and have been at war with one another for centuries.

3. Perhaps we might hope that African states worry more about how to keep themselves together and how to mend their internal divisions, rather than arbitrarily create more. It’s bad enough that the Kenyan government is weak and unresponsive to the needs of its citizenry, but the local governments haven’t shown themselves to be much more effective.

4. Perhaps, instead of dividing Africa even further, we might hope that African states learn to trade amongst one another. One of the main impediments to development is that fact that most African countries don’t trade with one another. There is no domestic trade economy. Could one imagine a world where European countries like Switzerland and Germany only traded with China and not each other? Cause that’s what’s happening in Africa.

5. Worse yet, it assumes that there is such a thing as a “natural” political unit. There is no such thing. All countries are artificially and have been created through mostly undemocratic means.

Worrying about colonial borders is a low hanging side show. While the colonial borders certainly impacted the ways in which modern Africa formed, in the end focusing on the issue is a convenient way of not having to dig more deeply into the complexity of present day facts. Present day Kenya is not a basket case simply because of misplaced borders. I think we should give Kenyans much more credit. These narratives often do to little to take African countries themselves to task for their own failings.

(Mostly) Vindicated: Euclidean measures of distance are just as good as high priced, fancy measures

DistancePlotsITNIn my seminal paper, “Distance to health services influences insecticide-treated net possession and use among six to 59 month-old children in Malawi,” I indicated that Euclidean (straight line) measures of distance were just as good as more complicated, network based measures.

I didn’t include the graph showing how correlated the two were, but I wish I had and I can’t find it here my computer.

Every time I’ve done presentations of research of the association of distances to various things and health outcomes, someone inevitably asks why I didn’t use a more complex measure of actual travel paths. The idea is that no one walks in a straight line anywhere, but rather follows a road network, or even utilizes a number of transportation options which might be lost in a simple measure.

I always respond that a straight line distance is as good as any other when investigating relationships on a coarse scale. Inevitably, audiences are never convinced.

A new paper came out today, “Methods to measure potential spatial access to delivery care in low- and middle-income countries: a case study in rural Ghana” which compared the Euclidean measure with a number of more complex measurements.

The conclusion confirmed what I already knew, that the Euclidean measure is just as good in most cases, and the pain and cost of producing sexy and complicated ways of calculating distance just isn’t worth it.

It’s a pretty decent paper, but I wish they had put some graphs in to illustrate their points. It would be good to see exactly where the measures disagree.

Background
Access to skilled attendance at childbirth is crucial to reduce maternal and newborn mortality. Several different measures of geographic access are used concurrently in public health research, with the assumption that sophisticated methods are generally better. Most of the evidence for this assumption comes from methodological comparisons in high-income countries. We compare different measures of travel impedance in a case study in Ghana’s Brong Ahafo region to determine if straight-line distance can be an adequate proxy for access to delivery care in certain low- and middle-income country (LMIC) settings.

Methods
We created a geospatial database, mapping population location in both compounds and village centroids, service locations for all health facilities offering delivery care, land-cover and a detailed road network. Six different measures were used to calculate travel impedance to health facilities (straight-line distance, network distance, network travel time and raster travel time, the latter two both mechanized and non-mechanized). The measures were compared using Spearman rank correlation coefficients, absolute differences, and the percentage of the same facilities identified as closest. We used logistic regression with robust standard errors to model the association of the different measures with health facility use for delivery in 9,306 births.

Results
Non-mechanized measures were highly correlated with each other, and identified the same facilities as closest for approximately 80% of villages. Measures calculated from compounds identified the same closest facility as measures from village centroids for over 85% of births. For 90% of births, the aggregation error from using village centroids instead of compound locations was less than 35 minutes and less than 1.12 km. All non-mechanized measures showed an inverse association with facility use of similar magnitude, an approximately 67% reduction in odds of facility delivery per standard deviation increase in each measure (OR = 0.33).

Conclusion
Different data models and population locations produced comparable results in our case study, thus demonstrating that straight-line distance can be reasonably used as a proxy for potential spatial access in certain LMIC settings. The cost of obtaining individually geocoded population location and sophisticated measures of travel impedance should be weighed against the gain in accuracy.

%d bloggers like this: