Thanks to Kit Baum, US state level geographic boundary files are available on the SSC archive (I am currently working on getting US counties level maps together as well) to
used with Maurizio Pisati's -tmap-.
-ssc desc usmaps- will bring up the available files.
The files include
usmaps.do
usmap.zip
usW_MW_Emap.zip
1. The usmap.zip file has "usmap.dta" which has boundaries for the 48 contiguous state
and the file "fips.dta" which is necessary to match geographic designation (FIPS code,
state name, or state abbreviation) to the variable "id" which is then used by -tmap-.
The reason fips codes could not be used to designate geographic areas is that several
states span multiple areas due to islands and stuff (i.e. the Florida Keys).
2. The usW_MW_Emap.zip file includes three regional files: "us_west.dta",
"us_midwest.dta", and "us_east". Also included is a sample data file
"rma_summary.dta" which has RMA summary of business data (US crop insurance data
on premiums, liabilities, indemnities, loss ratios, ect.).
3. The file usmaps.do will illustrate these files.
I have encountered some problems getting -tmap- is display all 48 states. When I try
to map all 48 states I receive an "invalid syntax" error. However, if I restrict the
number of regions it works. For example:
. use "D:\data\maps\rma_summary.dta", clear
(Summary of Business 2004 - From Public RMA website)
. tmap chor lossratio , id(id) map("D:\data\maps\usmap.dta") palette(Blues) ocolor(white) osize(medium)
invalid syntax
r(902);
However, if I restrict the id so that only a smaller number of states are displayed it
works fine.
. tmap chor lossratio if id > 114, id(id) map("D:\data\maps\usmap.dta") palette(Blues) ocolor(white) osize(medium) nolegend
works, displaying most of the states, expect for northern ones.
Or, this also works:
. tmap chor lossratio if id < 190, id(id) map("D:\data\maps\usmap.dta") palette(Blues) ocolor(white) osize(medium) nolegend
displaying most of the states, except for the southern ones.
I am not sure if the problem is with the my data or -tmap-.
Last week (12/14/2004) Austin Frakt <[email protected]> asked about, in part,
"I would like to be able to ... to highlight certain regions (clusters of states or counties) by, for example, drawing heavy lines around them or by inserting some white space (sort of pulling apart the map)."
One way of inserting some white space around regions would be to add (or subtract) from the boundary files to pull a region apart.
For example, if you want to highlight the northwest states you could:
. use "D:\data\maps\us_west.dta", clear
. replace _X = _X - 1 if fips == 16 | fips == 41 | fips == 53
(6994 real changes made)
. replace _Y = _Y + .25 if fips == 16 | fips == 41 | fips == 53
(6994 real changes made)
. save "D:\data\maps\us_west2.dta", replace
file D:\data\maps\us_west2.dta saved
. use "D:\data\maps\rma_summary.dta", clear
(Summary of Business 2004 - From Public RMA website)
. tmap chor lossratio , id(id) map("D:\data\maps\us_west2.dta") palette(Blues) ocolor(white) osize(medium)
and now, it looks like the Oregon, Washington, and Idaho are succeeding from the Union.
Scott
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/