Advanced Mapping with Stata: OpenStreetMap (OSM) and QGIS

Asjad Naqvi
The Stata Guide
Published in
21 min readApr 19, 2021


In this guide, we will learn how to import OpenStreetMap (OSM) data in Stata via QGIS which allows us to create extremely detailed choropleth maps from several spatial layers:

The above three cities have been my home in the past four decades, so this guide is a tribute to them! Please feel free to use this guide on any city or location of your choice.

This is the third installment in the Stata maps series and opens up Stata for any type of mapping allowing us to move towards more complex spatial analysis. This guide is recommended for more advanced users who are already familiar with spmaps, tmaps in Stata. If not, then I highly recommend the first map guide which introduces spmap, and the second map guide where we learn to reprograms maps. Most of this guide builds on the second one.


Like other guides, a basic knowledge of Stata is assumed. In order to make the graphs exactly as they are shown here, several additional item are required:

ssc install schemepack, replace

Set the schemes to one of the white background one for a clean look:

set scheme white_tableau, perm
ssc install palettes, replace 
ssc install colrspace, replace
  • Set default graph font to Arial Narrow (see the Font guide on customizing fonts)
graph set window fontface "Arial Narrow"
  • For workflow management, I use the following folder structure to organize the files, and paths refer to subfolders relative to the root folder:



Asjad Naqvi
The Stata Guide

Here you will find cool stuff on Stata and data visualizations.