Mainland Portuguese municipalities for Stata's maptile package. Maptile, written by Michael Stepner, provides a simple method to map a variable in Stata.
First, if you haven't done it aleady, install maptile and spmap:
ssc install maptile
ssc intall spmap
For now, the only option to install this geography is manually.
Unzip "geo_pt_mun.rar" and save it in PERSONAL/maptile_geographies, which is where maptile loads geographies automatically.
Alternatively you can save it in any folder in your computer and pass it on to the , geofolder(folder_path)
option in the maptile
command.
-
Choose your dataset wisely. Make sure it has data by municipality level, identified by official 4-digit DICO municipality codes for mainland Portugal. (There is a toy dataset in the "geo_pt_mun_creation" folder.)
-
Choose the variable you want to map.
-
Run maptile and specify the geography name (pt_mun):
maptile [varname], geo(pt_mun)
-
To see the geography's help file, use:
maptile_geohelp pt_mun
Here's how it looks! To create a pretty plot like this, you simply run maptile [varname], geo(pt_mun)
.
I plan to roll out tiles for additional administrative boundaries (NUTSII, NUTSIII, districts, parishes), as time permits.
There are two ways to run the code that builds this maptile geo template:
- Build using -project-
- Install the project command using
ssc install project
. - Then run
project, setup
and choose the do-file that begins with "build_". - Then run
project build_<geoname>, build
.
- Build interactively
- Open the do-file that begins with "build_"
- Edit the line that reads
global root "/Users/Gonçalo/Documents/GitHub/maptile_pt_mun/geo_pt_mun_creation"
. Replace the folder in that line with the folder on your computer that contains this do-file. - Run this do-file.
All templates based on the amazing work of Michael Stepner, stepner@mit.edu.