One of the main reasons I was convinced of the power of OSM when I first started to edit 8 years ago was the possiblity of seeing maps in my native language Tamil, spoken by 70 million people, which was till then unheard of. This is a huge factor in making technology relevant for people on the ground and breaking the notion that one needs to be literate in English or the Latin alphabet to be able to use modern tools like interactive maps.
There have been numerous experiments at making multlingual maps in India, I remember Yahoo maps having Indic streetmaps for India in 2007, but was soon discontinued. Google Maps for India is primarily in English and even in OSM we use the
name tag to record the name in the Latin alphabet for consistency. India has 22 languages, none of them universally understood by the whole country. Even the national survey agency makes only English maps, with a select few created in Hindi.
Hardly anyone in India even knows that OSM can handle regional languages, simply because its not visible anywhere on the map. After some recent interest from the community in making regional language maps for openstreetmap.in, I decided to give this a shot to make a multlingual place map for India using OSM and Mapbox Studio that I have been playing with recently.
Extracting the data
First step is to get some sweet OSM data. For India, we are looking for a places that have one of the regional language name tags
name:XX tag apart from the standard
name tag in English. This overpass query extracts such places with names in either Malayalam, Tamil, Telugu, Kannada, Bengali or Hindi. There are around 21,000 such places in the Indian subcontinent. You can easily modify the query for your own language.
Once the data is exported as a geojson, you can upload it as a new Mapbox Tileset that can be styled later. An important point to note is that Mapbox tilesets don't handle a colon ':' in the property names very well, as they are reserved characters. You will have to replace these with another character like underscore
_ in the geojson before you upload it. There's a handy bash command that can do this to your exported output.geojson :
sed -i -e "s/name:/name_"/g output.geojson
If you are comfortable with the commandline, you can extract the data, reformat and upload to Mapbox with these terminal commands.
Creating a new Mapbox style
I started of with a new Mapbox Studio style based on the 'Emerald' template, which is a great starting point to design a custom fully featured OSM based map. There are plenty of guides online to help you get started.
'Fixing' the boundaries of India
The official boundaries of India are slighlty different from whats displayed by default on OSM due to the dispute in Kashmir. Legally it is required to depict the entire erstwhile Kingdom of Kashmir as an undisputed part of India. To do this, I had the claimed boundaries extracted from various sources and have created a custom dataset that can be added to a Mapbox style.
The custom boundaries were added as a new layer in the style with a paint property similiar to the existing boundaries. With some tweaking, it looks close to perfect.
The defacto (OSM) and official boundaries of India
Adding custom language place labels on the map
Just like the custom boundaries, its rather simple to add the overpass datasets that was uploaded earlier. For convenience, I made duplicates of the existing place label layers, and modified the data source for each of them to use the uploaded places instead of the
mapbox-streets dataset provided as the default.
By changing the text field to use for labelling, we can instantly see the language change.
This is great, but does not solve the problem of allowing a user to switch between multiple regional languages of their choice.
Dynamic styling with Mapbox GL JS
Once the map was published in Studio, its possible to embed it easily into a custom html page using Mapbox GL JS. Inspired by the language switcher example that how its possible to switch between the default languages supported by Mapbox, I could extend the concept to switch the text field dynamically for the other custom layers in the style. The end output works like the animation posted at the top.
This should fill a huge void faced by the OSM India community in being able to use the map in their native language and also help us showcase the power of the project to local Government agencies.
Would be great to hear feedback and further ideas you may have to extend this process to your own community.