Mapping Health Indicators using Dynamic Layers in ArcGIS Server 10.1

ArcGIS Server 10.1 will introduce dynamic layers, which is the ability to change a map’s symbology (color, fill pattern, and outline characteristics, among others) on a per-request basis. Those who have used ArcIMS in the past may remember this capability fondly.

This Flex-based client application uses dynamic layer functionality, along with a variety of data filtering techniques, to let users explore relationships among various attributes in the data. It was built around data intended for users in the health care industry, but it could be used with any dataset containing numeric attributes.

You can find the application here.

Requirements

This application first and foremost requires map services running on an instance of the next release of ArcGIS Server–version 10.1. Also, due to technical reasons explained later in this post, the Firefox browser will probably produce unwanted network warnings as you use the application. Either use a different browser or apply the configuration-setting workaround to Firefox, as detailed below. (This issue should go away once the Flex API version 3 is released.)

The app currently requires a mapping service with a main layer (having some numeric attributes for viewing) and a background backing layer (with geometry only).

How to use the application

The map service behind this application stores a variety of health-related numeric attributes for the counties in the United States. The application can show up to four maps at one time; each one depicts one of the available numeric attributes in the map service. It can show a default attribute at load-time; in this case, it loads total population.

Find “Diabetes (percent), 2009” in the table of contents. Click it to show the map of diabetes rates, and close the 2010 Total Population map (you’ll see a close button in the upper right-hand corner, or you can click the highlighted “2010 Total Population” item in the table of contents).

You may click the left mouse button on any county to see a pop-up window with all attribute values for that county.

The counties shaded with a diagonal stripe pattern have no valid data associated with them. The counties are colored according to a quantile algorithm, meaning the map has a roughly equal number of counties from each of the legend categories at the top. You can change the renderer by clicking the legend and choosing a different algorithm, number of categories, or color ramp.

As you’re looking for patterns in diabetes rates around the country, you might want to examine one legend category at a time (for instance, only the counties with the highest rates of the disease). A quick way to do this is to hold the Ctrl key, click on a legend color, and hold the left mouse button down.

Filter criteria

The “Select counties…” dropdown offers a number of ways to filter counties based on their diabetes rates. “Top 10%” will show only the ten percent of all counties in the U.S. with the highest rates of diabetes. “Bottom 10%” will show only the counties below the 10th percentile. “Above average” and “Below average” do the same thing with respect to the 50th percentile.

The “Specify %” option lets you choose your own percentile for filtering the data.

Note that counties which don’t meet the filter are rendered transparent, allowing the background layer color to show through. In this screen capture, the worst 30% of counties (with respect to diabetes rates) are shown, whereas the rest—the best 70% of counties—are not displayed. Counties with no data continue to be rendered with the same diagonal pattern.

“Specify % range” lets you choose both a top and bottom percentile; in this case, we’re seeing the 40% of counties whose diabetes rates are clustered around the median:

Finally, you can use “Specify range” to choose counties falling within a maximum and a minimum percentage. A histogram shows the distribution of data across the entire set of counties.

Summary map

You might want to explore the relationship between diabetes and another variable—say the availability of fresh fruits and vegetables. Find “Few Fruits and Vegetables (percent), 2009” in the table of contents and click on it. A second map for that attribute will show up on screen. You can apply the same kinds of filters to the new map as were discussed above. Choose “Top 10%” as the filter for both maps.A glance suggests that both maps have some counties in common, but by no means all counties. Click the “Summary Map” button at the bottom left to see a combined map with only the counties shared by both maps.

These are the counties that are among the very worst for diabetes rates, and are also among the very worst for fruit and vegetable availability.

Post to ArcGIS Online

If you’re satisfied with this map and are ready to share your results with others, click the “Save to ArcGIS Online” button in the upper right. Enter your ArcGIS.com credentials (your Esri global account ID and password) and this map will be saved to your ArcGIS Online content list. After saving, you have the option to click a link to view the new map online in a web browser. You may need to enter your ArcGIS Online credentials again in the web application; after this, you should see the map displayed in your browser window.

Technical details

This application extends the DynamicMapServiceLayer class. Given a variety of parameters (class breaks algorithm, number of class breaks, desired colors, et al) it has logic to build a JSON renderer object and add it to the REST “export map” request; you can see this information if you have a browser debugger such as Firebug, Fiddler, or the Chrome Developer tools. ArcGIS Server version 10.1 can recognize that renderer and generate the proper symbology in the map image that gets generated and returned to the client for display.

Once the Flex API is updated and released for use with Server 10.1, this DynamicMappingLayer class can be scrapped and replaced with native Flex API calls to accomplish the same thing. During development, we ran into situations in which the export map request exceeded the maximum amount of data accepted by the Esri web adapter. For that reason, the DynamicMappingLayer makes all its requests via POST operations, not via GET.

We discovered that some versions of Firefox see these requests as an HTTP redirect operation, and end up warning the user (in a very annoying way) upon every new map request. So it’s easier to just useChrome or Internet Explorer with this application. If you’re set on using Firefox, however, you may use this workaround:

  1. Enter “about:config” in the Firefox address bar;
  2. Look for a config key called “network.http.prompt-temp-redirect” and set its value to false

I want to thank Patrick Mowrer for making available his multi-thumb slider control via the MIT License. His blog post on the component is here. I tried to use the (older) mx HSlider control for this, but found it had troubles when asked to handle very small fractional values. Mr. Mowrer’s control has no such limitations, although I did have to make a number of small modifications in order to be able to control the numeric precision of its dataTip.

Contributed by Mark D.

This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

3 Comments

  1. markdeaton says:

    The Flash Builder code is now available over at