Click here to see the SAS code. 
Click here to see the example.

This is a simple/innocent-looking map, but it has some
*seriously* tricky technology and functionality behind it...


This is a continuation of the analysis of the debris from the
space shuttle explosion.  In this example, the locations of the
individual pieces of debris are shown on a close-up map of 
several counties (each piece of debris is represented as a 
colored rectangle, with an id# as a label).  The rectangular
markers are color-coded, showing whether the piece of debris was
from the left wing, or the right wing.  The debris pattern 
clearly shows that the left wing broke apart first, and the
right wing did not break apart until the very end.

The rectangular markers are created using annotate, and the
html= varaible adds an html charttip/flyover-text to each 
marker indicating it's id# and exact longitude/latitude (this
is done using 'atl=').  Also, 'href=' is used to add a "drilldown"
such that when you cick on a marker, it shows you a layout of the
wing debris (if I had additional pictures, this could actually link
to a picture of this particular piece of debris, and even show 
exactly where the piece came from in the wing).

To create the county map behind the markers, I use several "tricks"...

I use the sas/graph maps.county dataset (instead of maps.uscounty)
because it has the raw/unprojected longitude/latitude coordinates 
in it (I need this, so I can combine and project it with the 
marker annotate data, and then gproject them together, and have
them line up correctly).  

When I "gproject" the map, I use some min & max values to "clip" 
out just the rectangular region I'm interested in.  I use the
following values ...

  longmin=93.85
  longmax=97.25
  latmin=31
  latmax=33

Since I'm not coloring the counties by some count (such as debris 
count), I just create my own fake 'data' set to use in the gmap.
When I create 'my_mapdata' I get the average long/lat coordinate
for that county, and I then create a string that contains the
url to request a mapquest roadmap centered at that long/lat
location, and I use that as the href= for my html variable.
When you mouse over the counties, you see the county name
in the html charttip/flyover-text, and when you click on the 
county it does a "drilldown" to the mapquest map of that county
(in the mapquest map, you can then zoom-in, and also get 
driving directions to that location).

And, one last little "trick" -- since I annotated the colored markers
for the debris pieces, there is no automatic legend.  I used 3 title 
statements, and use the 'U' character of the 'marker' sas/graph
software font to represent the colored boxes in the titles.
I then 'angled' the titles 90-degrees, which causes them to 
print sideways along the left side of the map.


Back to Samples Index