Tag: map

Polio eradication geographical modelling

I recently read with interest Dr. Gammino’s post on how geospatial data and microplanning is helping the CDC and its partners to work towards the eradication of polio.

There Dr. Gammino describes the hurdles faced by healthcare workers in countries where census data is often missing, where political, seasonal and geographical variations are making these more difficult. The description of the different social structures in urban or rural areas was also interesting. But the post also highlights how “social mapping” and geographic information systems (GIS) are helping understanding where the population resides and helping reaching them (here for polio vaccination but this could be for other purposes: maternity care, child care, etc.).

In Uttar Pradesh, households supporting polio vaccination in blue, those opposing polio vaccination in red (from Waggs)

In this respect, modelling could help determine the best strategy to reach still unknown population, where settlers could move, where to concentrate efforts e.g. And a few papers actually address these issues. For instance, Rahmandad et al. studied the impact of network types (networks between individuals) on the dynamics of a polio outbreak. Or Tony Wragg reported the influence of information campaigns on polio eradication in India (one could use information as an infectious agent).

Now it would be interesting to see the two worlds collide: having these geotagged information feed a prediction model and reverting back predictions to healthcare workers in the field to inform them of potential areas to visit. This would have some implications for logistics and these efforts should also address privacy questions. But it would potentially help eradicating polio too.

Map of GAVI eligible countries in R

I was trying to reproduce the map of the GAVI Alliance eligible countries (btw I was surprised India is eligible – but that’s the beauty of relying on numbers only and not assumptions) in R. This is the original map (there are 57 countries eligible):


I started to use the R package rworldmap because it seemed the most appropriate for this task. Everything went fine. Most of the time was spent converting the list of countries from plain English to plain “ISO3” code as required (ISO3 is in fact ISO 3166-1 alpha-3). I took my source from Wikipedia.

Well, that was until joinCountryData2Map gave me this reply:

54 codes from your data successfully matched countries in the map
3 codes from your data failed to match with a country code in the map
189 codes from the map weren’t represented in your data

I should have better simply read the documentation: there is another small command that needs not to be overlooked, rwmGetISO3. What are the three codes that failed to match?

Although you can compare visually the map produced with the map above, R (and rworldmap) can indirectly give you the culprits:

tC2 = matrix(c("Afghanistan", "Bangladesh", "Benin", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Central African Republic", "Chad", "Comoros", "Congo, Dem Republic of", "Côte d'Ivoire", "Djibouti", "Eritrea", "Ethiopia", "Gambia", "Ghana", "Guinea", "Guinea Bissau", "Haiti", "India", "Kenya", "Korea, DPR", "Kyrgyz Republic", "Lao PDR", "Lesotho", "Liberia", "Madagascar", "Malawi", "Mali", "Mauritania", "Mozambique", "Myanmar", "Nepal", "Nicaragua", "Niger", "Nigeria", "Pakistan", "Papua New Guinea", "Rwanda", "São Tomé e Príncipe", "Senegal", "Sierra Leone", "Solomon Islands", "Somalia", "Republic of Sudan", "South Sudan", "Tajikistan", "Tanzania", "Timor Leste", "Togo", "Uganda", "Uzbekistan", "Viet Nam", "Yemen", "Zambia", "Zimbabwe"), nrow=57, ncol=1)
apply(tC2, 1, rwmGetISO3)

In the results, some countries are actually given in a slightly different way by GAVI than in R. For instance “Congo, Dem Republic of” should be changed for rworldmap in “Democratic Republic of the Congo” (ISO3 code: COD). Or “Côte d’Ivoire” should be changed for rworldmap in “Ivory Coast” (ISO3 code: CIV). An interesting resource for country names recognised by rworld map is the UN Countries or areas, codes and abbreviations. Once you correct this, you can have your map of GAVI-eligible countries:


And here is the code:

# Displays map of GAVI countries
theCountries <- c("AFG", "BGD", "BEN", "BFA", "BDI", "KHM", "CMR", "CAF", "TCD", "COM", "COD", "CIV", "DJI", "ERI", "ETH", "GMB", "GHA", "GIN", "GNB", "HTI", "IND", "KEN", "PRK", "KGZ", "LAO", "LSO", "LBR", "MDG", "MWI", "MLI", "MRT", "MOZ", "MMR", "NPL", "NIC", "NER", "NGA", "PAK", "PNG", "RWA", "STP", "SEN", "SLE", "SLB", "SOM", "SDN", "SSD", "TJK", "TZA", "TLS", "TGO", "UGA", "UZB", "VNM", "YEM", "ZMB", "ZWE")
GaviEligibleDF <- data.frame(country = c("AFG", "BGD", "BEN", "BFA", "BDI", "KHM", "CMR", "CAF", "TCD", "COM", "COD", "CIV", "DJI", "ERI", "ETH", "GMB", "GHA", "GIN", "GNB", "HTI", "IND", "KEN", "PRK", "KGZ", "LAO", "LSO", "LBR", "MDG", "MWI", "MLI", "MRT", "MOZ", "MMR", "NPL", "NIC", "NER", "NGA", "PAK", "PNG", "RWA", "STP", "SEN", "SLE", "SLB", "SOM", "SDN", "SSD", "TJK", "TZA", "TLS", "TGO", "UGA", "UZB", "VNM", "YEM", "ZMB", "ZWE"),
GAVIeligible = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))
GAVIeligibleMap <- joinCountryData2Map(GaviEligibleDF, joinCode = "ISO3", nameJoinColumn = "country") mapCountryData(GAVIeligibleMap, nameColumnToPlot="GAVIeligible", catMethod = "categorical", missingCountryCol = gray(.8))

Human Development Index 2011

The United Nations Development Programme (UNDP) released its Human Development Report 2011. It “argues that the urgent global challenges of sustainability and equity must be addressed together – and identifies policies on the national and global level that could spur mutually reinforcing progress towards these interlinked goals“.

In this report, there is a ranking, the Human Development Index (HDI). The HDI is a way to measure the development. It combines indicators in three main dimensions: health, education and living standards. The mathematical way used to combine these indicators is explained in a technical note (PDF). The interest is of course to have a single number to use in comparison for both social and economic development. It’s not the only element to take into account to compare development. It’s merely a starting point giving an overview of development. An in-depth discussion about development and comparison between countries will need to go further and analyze each indicator separately (as well as other indicators if possible).

But human nature likes rankings. So be it. Here are the top 10 countries according this HDI:

1 Norway 0.943
2 Australia 0.929
3 Netherlands 0.910
4 United States 0.910
5 New Zealand 0.908
6 Canada 0.908
7 Ireland 0.908
8 Liechtenstein 0.905
9 Germany 0.905
10 Sweden 0.904

And the 10 least developed countries are all in Africa (again, according to the HDI):

178 Guinea 0.344
179 Central African Republic 0.343
180 Sierra Leone 0.336
181 Burkina Faso 0.331
182 Liberia 0.329
183 Chad 0.328
184 Mozambique 0.322
185 Burundi 0.316
186 Niger 0.295
187 Democratic Republic of the Congo 0.286

For information, China is 101st with an HDI of 0.687 ; Vietnam is 128th with an HDI of 0.593 ; India is 134th with an HDI of 0.547 (all three in the group of medium human development countries).

If I put all this in a map, it gives (thanks to the UNDP Statplanet tool):

Map of the Human Development Index 2011

The UNDP also has a data explorer tool à-la-Gapminder. Yesterday, I wrote about Hans Rosling’s talk urging us to continue to improve child survival in order to curb the world population growth. If I plot the HDI -vs- the “under-five mortality rate per 1,000 live births” (the probability of dying between birth and exactly age 5, expressed per 1,000 live births), I get the following graph that intuitively makes sense: the smaller is your under-5 mortality rate, the bigger is your HDI (meaning the country is more developed).

HDI -vs- under-5 mortality rate

Now the HDI is admittedly a theoretical value: it doesn’t take into account inequalities within each specific country. That’s the reason why the UNDP created in 2010 the Inequality-adjusted Human Development Index (IHDI). The IHDI is thus the actual level of human development (taking into account inequality). The average loss in the HDI due to inequality is about 23%. And although the loss is variable from country to country, it increases on average when you go down the human development index (HDI), see figure below. This average loss is the smallest in Europe and Central Asia (-12.7%) and the biggest in Sub-Saharan Africa (-34.5%).

Average IHDI loss

Mapping cameras in Liege

A lot of publicity is made around CCTV cameras in London (e.g. recently). But surveillance cameras are also invading other cities like Liege. You can be pro or against. The least thing is awareness: citizen should know where they are and how data is used. But nor the Liege city, nor the Liege police websites display a map of cameras. So I decided to create such a map here (in French). Of course, I cannot do everything by myself. If you know the location of some camera, just let me know and I will add them on the map.

Mapping my ride

GPS trackerNearly 2 months ago, I got a GPS tracker. I discovered its antenna is sufficiently sensitive to work in my pocket so I took it on my Saturday morning bike ride. Back home, I was able to retrieve data from the tracker in various formats. What can I do with this data? Find the total distance I rode, of course!

I am lazy 😉 so I decided to use the Kompass track file since it’s only a CSV text file (I should have used the GPX file format but parsing XML is still more difficult for me than a plain text file). With a rather simple Python script, I was able to store all the latitudes and longitudes in a collection of objects. But, hey, how do I compute the distance from longitudes and latitudes?

To find the distance between 2 points of which you only have latitudes and longitudes, there is a formula given by Dr. Math for example. To use this formula, you need the Earth radius. Since the Earth is not a perfect sphere, I’ll use an approximation of its radius at a given geodetic latitude (based on the latitude of the start point of my bike ride). With these two formulas, you can find the total distance of a GPS track (of course, it will still be an approximation).

So, this morning, I rode 14.5km at a mean speed of 27.5km/h (it’s only the beginning …).

But I want more! I want to see where I went on a real map! No problem … For that purpose, I’ll use Google Maps. In the same Python script, I define two GPoint: one for the start and one for the end of the trip (I also wanted to show the time of these points on the map). The path I did is just a GPolyline. The map is centered in the middle between the start and end points. The following elements can easily be customized: zoom level, path color, width and transparency. I added a parameter to be able to downsample data (in case of large data set). So, finally, I succeeded to draw this kind of map …

The map is included in a frame. If you can’t see it, here is the link to the map. Enjoy!

Now the most interesting part: here (22ko) is the Python code, all the graphic elements, the HTML template page, an example of track file from my GPS tracker and the map below (as usual, everything is under the GNU GPL licence).

Of course, you already have some similar services on the web. But only the GPS Visualizer is better than my solution, imho. In all other services I found (Gmaps Pedometer, MapMyRun et Walk Jog Run), you have to draw your path yourself: this is not precise and can be a pain if you have to enter many points. And, with my solution, I am happy I was able to solve this problem 🙂

All that to tell you that I started to ride my bike this year 🙂

First trace for OpenStreetMap

OpenStreetMap is a “project aimed squarely at creating and providing free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.” I thought it was worth participating and more documented than the UPCT project. So I got a Locosys NaviGPS GT-11 and used it for the first time on the way to FOSDEM (and back). I did a small mistake by taking an interval between points of 30s: on a highway, at 120km/h, 30s means 1km and the road direction can change a lot. When I’ll have more time, the next step will be to do some edition and mark roads, highways, interesting landmarks, etc. Stay tuned …

The GT-11 is only a GPS data logger. It has no built-in maps, road finder, etc. That’s why I got lost a little bit while trying to exit Bruxelles 😦 But, at least, you can see your errors later.