Save the map that saves lives

On April 25th, 2015, Nepal was hit by a 7.5 magnitude earthquake, killing over 8,000 people and injuring more than 21,000. The earthquake shook infrastructures, leaving many homeless, and damaging few of the most popular world heritage sites in Nepal. In the following days, aftershocks, rain and bad weather made rescue operations and relief work difficult.

I’m part of a community of mappers and cartographic emergency responders called the Humanitarian OpenStreetMap Team (HOT). HOT along with OpenStreetMap, a global community of over 2.1 million members, activates to help humanitarian agencies in times of crisis to provide up-to date geospatial information about settlements and infrastructures. HOT invites volunteer mappers to map buildings, settlements, roads, schools, hospitals, water sources, helipads, open areas and anything that can have a practical application in aiding disaster response.

Mapping Internally Displaced People Camps

The Nepal earthquake had a few of us not sleep for weeks. We mapped and worked with the single local agency in Kathmandu – the Kathmandu Living Labs – to understand the needs of aid responders on the ground, identify priority mapping areas, procure digital aerial and satellite imagery, design print maps, and communicate the needs to the global community over Skype and Internet Relay Chat. During the earthquake, there were over 30 mapping projects involved in mapping different parts of Nepal.

High contrast print map of Dudhpati village. Highlights humanitarian features – OpenStreetMap

USGS earthquake shake map on top of physical features to identify intensity – Mapbox

Within the 48 hours following the quake, over 2,000 mappers quadrupled road mileage and added 30% more buildings and infrastructure data. This is in addition to the data created by the local community well before the quake. These maps and data were used by agencies like the American Red Cross, Canadian Armed Force and the Nepalese National Army to support the effort of saving lives. Maps save lives.

Captain James Borer, Canadian Armed Forces Disaster Assistance Response Team and Captain Animesh Adhikari, liaison officer for Nepalese National Army, discuss with local authorities about roads status, in Sindhupalchok District, Nepal. Photo by Corporal Kevin McMillan.

These maps and numbers are powerful – more powerful than the Geospatial Information Regulation Bill from the Government of India. The bill proposes to control acquisition, dissemination, publication and distribution of geospatial data both within India and by Indian citizens outside the country. The Bill will make years of work of millions of geographers, cartographers, and technologists around the world, including mine, futile and potentially illegal or criminal.

Flooded Streets helped anyone find streets that are safe or otherwise in Chennai

In January 2016, when Chennai was hit by a massive flood that displaced over 1.8 million people, citizen collectives and organisations came together to the rescue. With fellow cartographers and volunteers, we created a map to identify flooded streets to facilitate transporting food, water and consumables into the city from elsewhere. Earlier, in October 2015, when parts of Afghanistan and Pakistan were hit by a 7.5 magnitude earthquake, volunteers got together to create maps, but unclear mapping laws made it complicated.

Soon after, I wrote about what change I would like to see in the HOT community – being able to work closely with traditional agencies.

The proposed Geospatial Information Regulation Bill has the effect to shutdown Humanitarian OpenStreetMap Team in India and silence volunteer mappers, cartographers, and data analysts who support humanitarian response, basically stopping them from saving lives. The Bill prevents any individual or organisation from using satellite or aerial imagery; it also blocks the use of assisted equipments to collect geospatial information and the possession of such data. This means that, from now on, no one will  ever be able to make a map of India, or parts of this country, for anything – humanitarian or business – without the approval of the authorities.

The potential consequences of the Bill are dramatic. Preventing people from making maps affects how they live in our country, it breaks down disaster response, and troubles our economy.

We need your help to save the map.

OpenStreetMap as Infrastructure – The Fifth Elephant, Bangalore, 2014

I spoke at the premier data conference in the country yesterday, the Fifth Elephant run by HasGeek, about using OpenStreetMap as infrastructure for geographic datasets and applications featuring Moabi – a collaborative mapping platform for monitoring natural resources extraction in the Democratic Republic of Congo. Find the summary of the narration here and a more detailed outline here. The slide deck is below.

Download (PDF, 6.12MB)

 

 

Bringing together map enthusiasts in Bangalore.

A few months back, Kaustubh and I started GeoBLR – Bangalore’s monthly spatial gathering. Few weeks back we did the fifth meetup. I have been wanting to write why I’m organising GeoBLR and more importantly, why I am taking it slow.

We started off GeoBLR to keep it quite different from other events in town. To begin with, we don’t necessarily have someone speaking at all the events. The GeoBLR events are more open in terms of what we want to do. GeoBLR runs closely with the DataMeet on issues centric to spatial data and maps. We had several discussions around the spatial data situation in India and how building proper relationships at the government and non-government level is important for the community to gain access to the datasets.

There has never been a space in Bangalore to talk about issues like this. When proprietary companies around the world are trying to be the single source of ground truth, opening map data is a critical task. Improving OpenStreetMap is at the core of our agenda. GeoBLR will be a space for people to come and talk about maps, discover new tools, identify missing datasets, find them, and solve spatial data related issues.

I have been getting fair amount of requests to turn GeoBLR into a series of workshop and I’m not keen on that idea. GeoBLR, in a way, is an experiment for me. From simple things like ‘which day of the week/month is best for people to attend the event’ to ‘what model the event should focus’, I’m learning a lot and subsequent events get more clarity.

If you want to learn more, join us!

Crowdsouricng Data: Strategies, Stories, Tools.

I was a facilitator at the Techcamp Bangalore where I introduced several strategies of crowdsourcing data to the broad group of non-profit organisations. My idea was to walk the participants through two stories that I’m personally part of – Akshara Foundation and the Humanitarian OpenStreetMap Team – by asking four key questions – What data to collect, from whom to collect, how to collect and, how to verify. We had some interesting conversations at the event but most of them were in to learn about more tools. I put together a small slide deck and a repository for collecting tools and reading material.

Designing a New Map Portal for Karnataka Learning Partnership.

Wrote a rather detail post about the new maps for Karnataka Learning Partnership on the geohackers.in blog.

The map is an important part of our project, action and process because it serves as the pivot point of navigation. I will quickly talk about the data and tools before we discuss the design aspects.

We have a fairly large dataset of schools in Karnataka. The name of the school, location, number of girls and boys etc. in a database. Fortunately, the data was clean and properly stored in a PostgreSQL database with PostGIS extensions. Most of my task was to modify the API to throw GeoJSON to the client using the ST_AsGeoJSON function and export the data.

read more…

Zoom level based marker interaction using Leaflet.js

With Arky I was creating a map of the Mozilla l10n teams world wide and decided to use Leaflet.js. He send across a CSV data sheet which contained the geo-tagged teams and other information. Wrote a Python script to generate markers corresponding to Leaflet.js (Yes, my JS skills suck). When we laid the markers on the map, we found that it looked all crowded and difficult to locate one team quickly. I took this discussion to the HasGeek channel and Nigel showed me the Ubuntu Loco Global Events map. The markers in the map changed based on the zoom level of the map. That is pretty neat idea to handle crowded map markers. But they were using Google Maps.

I wanted to make this happen with Leaflet.js and OpenStreetMap data. Leaflet.js is perhaps the best, easy and intuitive interactive mapping library that I’ve come across. I spent some time in the documentation and came up with this idea and voila! – it worked.

Leaflet.js provides several events, the one which we will use is zoomend. This event gets triggered whenever the zoom level of the map changes. Exactly what we need. This is how I did it.

If you have a bunch of markers, use LayerGroup, that will give you better control. You can now add/remove the entire marker set by the LayerGroup handler.

Setting up Mapnik for rendering tiles in your language.

Mapnik is the default renderer on the OpenStreetMap main site. We can setup our own OpenStreetMap server for rendering the tiles either online or offline. This note would help you to setup an offline one (online if you do on your server) with special eye on font setup for localized tiles.

To render the tiles using Mapnik, you need to create a PostgreSQL database out of the OSM data. Then install Mapnik depending on the Operating System you run. These primary steps are very well covered in the following pointers.

  1. Setting up PostgreSQL database out of the OSM data. Read more.
  2. Build your own OpenStreetMap server – Richard Weait. Read more.
    • For Ubuntu Lucid Lynx read here.
  3. Using Mapnik for rendering the tiles – Richard Weait. Read more.

Once you are done with the above steps, we might think of tweaking the Mapnik rules to render the tiles in a local language. For this all we need to do is point Mapnik to the right font. You can quickly follow the steps briefed by Richard, here.

You can run

python
>>> from mapnik import *
>>> for face in FontEngine.face_names(): print face
… [Enter]

DejaVu Sans Bold
DejaVu Sans Bold Oblique
DejaVu Sans Book
DejaVu Sans Condensed
DejaVu Sans Condensed Bold
DejaVu Sans Condensed Bold Oblique
DejaVu Sans Condensed Oblique
DejaVu Sans ExtraLight
DejaVu Sans Mono Bold
DejaVu Sans Mono Oblique

……………………………………..

>>> Ctrl-d

to see what fonts are currently being recognized by Mapnik. The second task is to install the local language unicode font to Mapnik’s default font directory. If you have already installed Mapnik, you can run strace -ff, and search for font to see which directory is used by Mapnik. In my case it was the default directory at /usr/share/fonts/

Next, you need to copy the required fonts to the above directory. You might run the python code snippet again to see whether Mapnik recognizes the fonts. For example, in my case, it looks like this.

DejaVu Sans Bold

DejaVu Sans Bold Oblique

DejaVu Sans Book

DejaVu Sans Condensed

DejaVu Sans Condensed Bold

DejaVu Sans Condensed Bold Oblique

DejaVu Sans Condensed Oblique

DejaVu Sans ExtraLight

Rachana Regular —> new one
Note the name of the font that appears in the above list. This name would be used in the Mapnik rule file.
Now, we’ll edit the Mapnik custom rule file, as described below.
You can find this in ~/mapnik/<template name>.xml. Open the file in an editor of your choice. The file begins with something like this.

<FontSet name=”bold-fonts”>
<Font face_name=”DejaVu Sans Bold”></Font>
</FontSet>
<FontSet name=”book-fonts”>
<Font face_name=”DejaVu Sans Book”></Font>
</FontSet>
<FontSet name=”oblique-fonts”>
<Font face_name=”DejaVu Sans Oblique”></Font>
</FontSet>

Change the face_name to the font name we just copied to the fonts directory.  In my case, it would look like this.
<FontSet name=”bold-fonts”>
<Font face_name=”Rachana Regular”></Font>
</FontSet>
<FontSet name=”book-fonts”>
<Font face_name=”Rachana Regular”></Font>
</FontSet>
<FontSet name=”oblique-fonts”>
<Font face_name=”Rachana Regular”></Font>
</FontSet>
Mapnik rule file defines fonts for each of the possible tags which appear in the map data. You need change that in order to apply the special fonts to specific tags.

<TextSymbolizer name=”name” fontset_name=”book-fonts” size=”11″ fill=”rgb(0,0,0)” halo_radius=”1″></TextSymbolizer>

You can edit the lines which are like as shown above. Change the fontset_name, to the one you want. And run the renderer! You are done!
I have two images to egg you on!
Before installing font After installing fonts
DejaVu Sans Bold
DejaVu Sans Bold Oblique
DejaVu Sans Book
DejaVu Sans Condensed
DejaVu Sans Condensed Bold
DejaVu Sans Condensed Bold Oblique
DejaVu Sans Condensed Oblique

DejaVu Sans ExtraLigh

Thanks to the #osm channel irc.oftc.net and Richard Weait for helping out to figure the changes.