Using Stata to Create Interactive Maps

嚜燃sing Stata to

Create Interactive

Maps

Ali Lauer and

Austin Nichols

July 27, 2017

Stata Conference

Contents

∫ Standard maps in Stata

每 twoway command

每 shp2dta command

每 Geographic analysis

∫ Interactive Maps

每 file command

每 Javascript and JSON objects for the web

Abt Associates | pg 2

twoway

∫ Maps can be constructed in Stata using twoway commands

每 Built-in command

每 Available in secure environments

∫ Use polygon ※shape file§ dataset

每 twoway area

每 Options: nodropbase cmiss(no) yscale(off) xscale(off)



Separated by || or set off by (), as in any graph

Map Types:



Choropleth: use multiple calls to area each with if qualifiers to build a

choropleth



Point Data: use scatter to superimpose point data

Abt Associates | pg 3

shp2dta

∫ shp2dta command converts various shapefile

formats into Stata data

每 User-written command by Kevin Crow, freely available

through SSC Archive

每 Shape file (coordinates file) contains _X (longitude), _Y

(latitude), and _ID (shape identifier) variables

每 Data file has info on each shape

? .shp

? .dbf

shp2dta 角

2 Stata datasets:

? Shape file

? Data file

Abt Associates | pg 4

Example 每 Mapping Census Tracts

∫ Map of Census tracts in Delaware,

with one county highlighted

∫ Download the shape file from

Census Bureau

每 Publically available data

∫ Convert to a Stata dataset using

shp2dta command

∫ Map using twoway command

Abt Associates | pg 5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download