Disputed territories and merging shapes and features

Making a map that shows a disputed territory can be a tricky business. Nation states vigorously contest maps that appear to portray a boundary that challenges what a border looks like. From the Falkland Islands to Kuril Islands; from Western Sahara to Arunachal Pradesh, disputed territories result in omissions, additions and inaccuracies in maps.

I grew up looking at maps in books printed by the Oxford Press, that came with a disclaimer in blue rubber stamped across them that stated how the map was wrong. This was due to the fact that the maps showed only the parts of Kashmir being administered by India, thereby omitting areas under Chinese and Pakistani control. The Criminal Law Amendment Act, 1961 in India makes it punishable with imprisonment up to 6 months to publish a map that excludes all or parts of Kashmir1.

This creates a lot of trouble for people who make maps for fun or to visualize data. Survey of India does not make it easy to get hold of shape files that represent India’s boundaries, and all the shape files that are available from international sources exclude parts of Kashmir. So, how do we solve this problem?

The North American Cartographic Information Society’s Natural Earth 2 maps has all the disputed territories available for download as shape files. One way to solve the issue on our hands will be to take the shapes relevant to Kashmir from this file and merge it with the rest of India.

We will explore how to perform and an operation like this through QGIS 3.

Open the disputed areas shape file in QGIS.

Select all the regions in Kashmir that are seen by India as it’s territories.

In order to make merging these shapes easier, we will introduce a new attribute on them. Go to Layer → Open Attribute Table.

Switch to editing mode in the Attribute Table by clicking the Toggle editing mode button.

Click New column.

Choose a name for the column. In this example we are using target. Select Text (string) as the Type and choose a number like 10 for width.

For all the selected shapes, set the value of target to Kashmir.

Use the Dissolve tool, found at Vector → Geoprocessing tools → Dissolve to dissolve the shapes in to a single shape file. Choose target as the value for dissolve field. Save the output to a new shape file.

Install the QGIS plugin MergeShapes. Plugins can be installed from Plugins → Manage and Install Plugins.

Copy the India shape file from DIVA-GIS and the newly generated Kashmir shape file to a directory.

Merge these into a single shape using Vector → MergeShapes → MergeShapes.

With that we have a shape File for India that closely resembles India’s official version.

Once we have the shape File for Kashmir from step 8, we could do the merging by converting both shape Files to their corresponding GeoJSON formats and doing simple JavaScript operations on the objects.

Load the two feature collections in to a JavaScript console. I tend to use Chromium’s Developer Tools, but in this example I am using Node.js’ REPL.
javascript
kashmir = JSON.parse(fs.readFileSync("./kashmir.geo.json").toString());
india = JSON.parse(fs.readFileSync("./india.geo.json").toString());