Deriving Vector Layers of Administrative Boundaries from OpenStreetMap

By Arjun Gangadharan, Product Lead — GIS, SatSure

Note: This article is written in the Indian context; hence all the boundaries are based on the Indian scenario. Although the procedures are the same in extracting the boundary for other countries, the hierarchy levels and names might differ. Hence it is advisable to check with the local community documentation for a better idea.

We often use different boundaries to mke different map depending upon the use case. We have country boundaries made up of state boundaries made up of the lower units — district boundaries, and so on. So given the smallest unit wards boundary, we can make the entire country boundary by merging those. But that is not the case if we consider a different type of boundary. Hence we have three different types of boundary scheme followed in India

  1. Administrative boundary
  2. Political Boundary
  3. Local Government Boundary

The Hierarchy of Boundary scheme used in India are

These boundaries are selected depending upon the use case of the map prepared or analysis done. For example: Consider the population of an area. It is mentioned and visualized in the administrative boundary map (State, District boundaries) to prepare a per capita income of the state for any economic survey while the same population is mentioned in Political boundary map when talking about the voting percentage of a constituency. It makes it more complicated in India in the case of political boundary and local government boundaries since they are highly dynamic in nature. Changes can be expected once in 5 years or so. The reasons can be many, but the most common reason is the area’s population or economic growth.

Apart from these boundaries, we have police station boundaries, postal boundaries, court boundaries etc. to solve problems geospatially like service area algorithm, within an area (of jurisdiction or similar) different boundaries are required.

OpenStreetMap is the best option to get the updated layers of these boundaries as it is a crowdsourced map. OpenStreetMap India community volunteers have put their efforts not only to map the boundaries but also to document the hierarchies of the boundaries which are in practice. Have a look at the OSM India wiki page on existing boundary level hierarchy and even the proposed levels for accommodating more data.

Here in this article, I explain two methods to extract boundaries — Overpass turbo API and using QGIS. There are a lot of other ways as well.

Overpass turbo API

Source: https://wiki.openstreetmap.org/wiki/India/Administrative_Boundaries

  • If you need to extract only a specific district only write a combined query with the district name or wikidata QID. Note while giving the name it should be the same name which is under the name tag given in OpenStreetMap. For example for Pune District, it is given as “Pune District”, while for Hyderabad it is just “Hyderabad”. There might be reasons for this nomenclature. The easy method knows this is the first query without a name and will check the value of the name tag of the required district then add the tag to query and rerun it.
  • Example:
  • The results will be displayed in the map window at the right.
  • Click on Export and choose the required format. For ESRI shapefiles download in geojson and convert using QGIS
/* The original search was: "admin_level=5 and boundary="administrative"" */ [out:json][timeout:1000]; // gather results ( // query part for: "admin_level=5 and boundary=administrative" node["admin_level"="5"]["boundary"="administrative"]({{bbox}}); way["admin_level"="5"]["boundary"="administrative"]({{bbox}}); relation["admin_level"="5"]["boundary"="administrative"]({{bbox}}); ); // print results out body; >; out skel qt;admin_level=5 and (boundary="administrative" and name="Pune District")

QGIS

QGIS has lots of plugins to download OSM data directly as QGIS layers. Here I am using the Plugin QuickOSM.

Key : local_authority:IN Value : municipality

  • The result of the above query has given an out of polygon layer with all municipalities of Kerala.
  • You may need to clean the attribute table a bit as it may contain a lot of columns which may not be required. Also, manually delete if there are any additional polygons in the resultant layer. You can either use the selection by query tool or manually delete it from the attribute table.

Note: As Openstreetmap is mapped by crowdsourced or volunteering possibility of unmapped areas are there. Have a look at the respective boundary page in OSM wiki or with sample query verify that you have the required data. If you don’t find any boundary, you can also populate the OSM database with those maps. Remember to follow the OSM editing guidelines.

Plugins > Manage and install plugins

Click on All, search for QuickOSM and then click the Install plugin button

For example, I am downloading all the Municipalities of Kerala.

Originally published at https://satsurecommunity.medium.com on January 13, 2021.

Geospatial Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store