Posts Tagged ‘symbol’

Making a map look prettier

Problem: Your map is going to be used for a special purpose and it needs a little something extra to give it that polished, professional look.

On St. Patrick’s Day, the ESRI Mapping Center blog posted one of the award winners of the 2009 International User Conference Map Gallery Competition. The title of the map is “Geo-Geneology of Irish Surnames.” Besides being interested in the subject matter because I am of Irish descent, I think it is a beautiful presentation. So beautiful, in fact, that I printed out two copies on photo paper: one for my office and another as a Saturday party decoration.

I started thinking about the ingredients that make this map look so good. It was made entirely within ArcMap, which means it’s possible take ideas from it that would improve the appearance of any map created on the job. I noticed four things in particular that I have seen on other professional maps hanging on walls, but which I hadn’t tried before. I taught myself how to do them, and now I will teach you.

1. Shaded Relief Background
The map uses a color gradient to display different elevation values. This imparts a subtle texture that makes the background spring to life. I was able to achieve a similar effect using a combination of a hillshade with a carefully symbolized DEM surface. I used the USGS GTOPO30 for this. GTOPO30 is a Global Digital Elevation Model with a horizontal grid spacing of 30 arc seconds–approximately 1 kilometer.

First, I clipped it to my map area in order to make it easier to work with. ArcToolbox’s Data Mangement Tools –> Raster –> Clip function will clip any raster to bounding box coordinates that you either type in directly, or import from a shapefile. Here, I’ve imported the bounding coordinates from a shapefile of the Ireland country boundary.

Now that the DEM has been clipped to a manageable size, creating a hillshade will go much faster. Hillshading is a method of representing relief on a map by depicting the shadows that would be cast by high ground if light were shining from a certain direction. You can create hillshades from the the 3D Analyst toolbar.

When the tool comes up, it will ask for several values which are fine to keep at the defaults, except for the Z-factor. The ESRI Help document on hillshades notes that if the x,y coordinates of your data are in angular units (degrees), the hillshade output is going to look funny. This happens because the elevation values are in linear units, and the length of a degree of longitude changes with latitude. So, if your x,y units are in decimal degrees and your z units are in meters (which is the most common case and the case with GTOPO30, which is in GCS WGS 1984), ESRI recommends using the following table of z-factors:

Latitude Z-factor
0 0.00000898
10 0.00000912
20 0.00000956
30 0.00001036
40 0.00001171
50 0.00001395
60 0.00001792
70 0.00002619
80 0.00005156

Ireland is at about 50 degrees latitude.

The output, which I named “shadow”, is a grayscale shaded relief that looks like the land surface with hills and valleys. We are going to drape it over a color-coded DEM. The hillshade will provide the light-dark values and the DEM will provide the hue values. I found that my hillshade looked the best with the following contrast and transparency percentages. (You can find these settings on the Layer Properties, Display tab).

Now, go back and choose colors for the original clipped DEM (gtopo_1km_Clip1). After a lot of trial and error I got my best results with 6 color classes, ranging from green at the lowest elevations through brown to white at the highest elevations.

2. Gradient Water Bodies
Using a gradient fill to symbolize the lakes creates an effect called “sunglint”. I’d never heard of it before, but it’s easy to to do, and quite pretty. In the Symbol Property Editor, change the Type to Gradient Fill Symbol. Raise the Interval value to something higher than the default 5. This will blend the colors better. You’ll stop noticing the difference much over 50. Now, pick a blue color ramp from the list.

If you want to, you can tweak the pre-made ramps by right-clicking on them and selecting properties. I didn’t like the darker blue end of mine, so I removed it.

Note: If you click properties again, you can change the two colors that make up the ramp, as well as the blend algorithm and the black and white brightness.

3. Coastal Vignette
The Irish map makes dramatic use of this, so that the coastline appears to glow out of the–in their case–green background. Most other maps use a subtler effect of the coast fading into blue water. To create that look, first change your background color by going to the Data Frame Properties, Frame tab.

Then, create multiple copies of your country boundary in your table of contents. Each copy should be symbolized with a white hollow border that has increasing width and transparency as you go down. Here are the settings I used:

4. Colorful Administrative Boundaries
This takes a bit of time, but the result is lovely. The idea is to have each county outlined by a border that’s shaded a different color from the counties surrounding it. The borders need to touch, but not overlap. And, the borders need to fade, like the coastline, but not quite as much. So, how to do it?

Before you start picking colors, you need to solve the overlap problem. (I learned the hard way that this step will undo your color choices). Symbolize by category: province name, then right click on any province in the list and select Properties for All Symbols. Click the Properties button, the Outline button, and then the Properties button once again. Now, change the line Type to Cartographic Line and the Offset to -0.5.

Note: The offest should be negative half the width of your line. My line width is 1.

Now, go back to the first screen and pick your border colors. If you keep the window open and keep hitting Apply, you can check your results as you go to make sure you don’t put two of the same color next to each other.

When you’re finished, make a second copy of this layer, and put it underneath the first in the table of contents. Then, double the border width and the offset. Important: also go to the Cartographic Line tab and set the Line Caps and Line Joints to Round. This will avoid spikes from showing up at wider widths. Fair warning: when you do this, your colors will be all be reset to black, and you will have to go back and fix them one by one. I’m sorry.

It’s totally worth it. Set the transparency on the bottom layer to 50%. And, you end up with:

Isn’t that nice?

Tags: , , , , ,

Embedding a custom Google mashup

Problem: You need to display GIS data on a webpage on top of a familiar basemap with basic zoom and pan tools.

There are many ways to do this. The one I will explain today doesn’t require programming skills, specially configured servers or proprietary software. Note: I borrowed heavily from Havard University’s Google Maps tutorial for this entry. They have an excellent free web-based GIS Technical Training Workshop Series.

The basic map they provide is all you really need to get started. The HTML file is structured and commented in such a user-friendly way that you will be able to start editing it to make common customizations to your map almost immediately. No need to wade through the Google Maps API Documentation until you’re ready to try something more complicated.

Go to http://maps.cga.harvard.edu/samples/basic.html and save the html source document (basic.html) to your harddrive. Then open it in a text editor.

The first thing you will probably want to change is the area of the world that the map is showing. To do that, change this bit of code, which is right now centered and zoomed to show the United States.
//Sets the initial map location and zoom level (latitude, longitude) in decimal degree format (zoom level) 1 - 21
gmap.setCenter(new GLatLng(39.10960, -96.5), 4);

For my example, I’m going to make a map of the recent Haiti earthquake. There’s been a lot of that going on recently as geo-Pros have been banding together to speed information to the relief workers.

I’ve changed my center coordinates to the location of the main quake, and upped my zoom so Hispaniola island fills the screen:
gmap.setCenter(new GLatLng(18.44, -72.54), 7);

Now, I’m going to change the starting style to make it a little less busy, since I’m going to be adding things. Uncomment the second line in the code here.
//Sets the initial map to load. Change between PHYSICAL, SATELLITE, HYBRID, NORMAL. Default is NORMAL
//gmap.setMapType(G_PHYSICAL_MAP);

When commented out, it will default to NORMAL. If you want to change that, you will need to delete the // in front and change it to one of the options above. Like so:
gmap.setMapType(G_HYBRID_MAP);

Note: PHYSICAL is an attractive terrain map that is not available in standard google maps. It’s tempting to use it, but it’s still too bright for the things I’m going to add next to show up well.

My map is centered on the location of the quake, but I also want to add a pointer to show exactly where it happened. To do that, insert the following code after the line where you changed the background map style.

//Adds a marker with window information
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var point = new GLatLng(18.44,-72.54);
var marker = createMarker(point,'Magnitude 7.0 Earthquake Jan 12, 2010');
gmap.addOverlay(marker);
//End of add marker code

The editable areas in red are where you can change the coordinates of the marker and the description in the pop-up box.

I will also plot the locations of a couple aftershocks that occurred over a week after the initial event. I got these locations from the USGS Earthquake Search page at http://neic.usgs.gov/neis/epic/epic_circ.html
var point = new GLatLng(18.38,-72.85);
var marker = createMarker(point,'Magnitude 4.9 Aftershock Jan 21, 2010.');
gmap.addOverlay(marker);
var point = new GLatLng(18.48,-72.45);
var marker = createMarker(point,'Magnitude 4.4 Aftershock Jan 22, 2010.');
gmap.addOverlay(marker);

You can continue adding as many points as you like in this fashion.

You will probably want to change your markers so they don’t all look the same. In my case, I would like to distinguish the earthquake from the aftershocks. You can use any of the icons shown on this page, instead of the default marker. To do that, add this code block right before the //Adds a marker with window information block:

//javascript that sets up variables that enable the map to draw a custom icon.
var baseIcon = new GIcon();
baseIcon.iconSize=new GSize(32,32);
baseIcon.shadowSize=new GSize(56,32);
baseIcon.iconAnchor=new GPoint(16,32);
baseIcon.infoWindowAnchor=new GPoint(16,0);
var custom_icon = new GIcon(baseIcon, "http://maps.google.com/mapfiles/kml/pal3/icon28.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon28s.png");
//end of custom icon code

Change the red pal group number and icon number to match the icon you want to use. Then, add the blue text to the end of these lines:

//Adds a marker with window information
function createMarker(point,html,icon) {
var marker = new GMarker(point,icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
var point = new GLatLng(18.44,-72.54);
var marker = createMarker(point,'Magnitude 7.0 Earthquake Jan 12, 2010.', custom_icon);
gmap.addOverlay(marker);

Note: if you wanted to use two types of icons, you could define (for example) a custom_icon2 above and assign it below, in the same manner.

It is simple to add KML files, which were developed for use with Google Earth, to these maps. Although shapefile is still the most common format, KML is becoming more and more available. My favorite new data search tool, the Geocommons Finder! offers its entire catalog in KML format (along with SHP and CSV).

To add a KML layer that shows the locations of hospitals in Haiti, you’d insert the following code right before the //Close bracket for the function initialize:
//Adds a kml overlay
var geoXml = new GGeoXml("http://finder.geocommons.com/overlays/20906.kml");
gmap.addOverlay(geoXml);
//End of kml overlay code

You can add as many of these as you like, and change the URL to point to whatever file you’d like. Note: If you, like me, have most of your data in other formats, you can use Havard’s Export to KML: Version 2.4 ArcGIS extension (see list on right side of page) before adding it to a mashup.

Here’s my Haiti map with all the changes I described. View the source to see them in context.

Tags: , , , ,

Saving symbology to use again

Problem: You have encountered or created some really nice symbols and want to stash them away for future use.

Sometimes it takes forever to get a symbol just right. And sometimes you’re looking at a map or layer file made by someone else and just love what they’ve done. In either case, it is not necessary to repeat the work, because you can save symbology definitions in a couple different ways.

The ESRI Streetmap package comes with a layer file that can be used to produce pretty maps from the data. In particular, I like the orange star symbol they use for state capitals.

In order to save it for re-use, I would follow the steps below. These same steps also can be used to save line symbols, fill symbols (for polygons), and font definitions (for text labels).

Bring up the Layer Properties, Symbology tab, and double click on the symbol to open the Symbol Selector. (For text labels you get to the Symbol Selector by going the Labels tab and pressing the Symbol… button). On the symbol selector screen there is a Save… button. If you press it, it will ask you to give the symbol a name and a category.

That’s really all there is to it! Your saved symbol will now appear at the top of the list of symbol choices. It will be there whenever you open ArcMap from now on, available for use like any other symbol. In addition, if you go to the Category drop down you will be able to see only the symbols in the category you just created. So, for instance, I could save all the ESRI Streetmap symbols I like, and give them that same category name to make them easy to find later. (Note: The new category may not show up right away, but if you open and close ArcMap it will be there next time).

So, how does ArcMap save these symbols and where does it look for them next time? It saves them into something called a .style file. Every custom symbol defintion that you save is stored in your personal style file, located in \ApplicationData\ESRI\ArcMap\username.style. The ESRI styles are stored in \Program Files\ArcGIS\Styles. Both your personal style and the default ESRI style load every time ArcMap does. You can access the other ESRI styles by clicking on the More Symbols button in the symbol selector.

Just like layer files, you can manipulate these style files and share them with others. I found a cool one that Brady Davis shared back in 2005 to use as an example. He created a style based on Google Maps. You can download it at: http://conversationswithmyself.com/181/ Once you unpack it, you can add it to ArcMap by pressing the More Symbols button and selecting Add…

You can get to all the new Google symbols by navigating through the symbol selector for different symbol types. But if you’d like to take a quick peek at everything all at once, that’s what the Style Manager is for.

You can open the Style Manager by going to Tools –> Styles –> Style Manager in the main ArcMap interface. You will see your personal style there, the ESRI default style, and any other styles that you may have added or turned on. Here’s how the Google style looks:

You can see from the folder names that you can control much more than just point, line, fill and text symbols with the style manager. Folders are colored yellow if they have something in them.

Also, with the style manager, you can create new styles, and copy and paste elements from one style into another. So, you could copy all your favorite symbols into you personal style. Or, you could create and populate a style specifically for sharing with others. You can also delete elements you don’t like to reduce clutter.

In addition, Tools –> Style –> Style References lets you pick which styles will show up in the symbol selector window. So, you could create an mxd that only references a custom style you have created, thereby limiting the user’s options to a list of standard symbols.

So, with just a little tweaking I used the Google style to googleize a section of downtown Richmond.

Not too shabby! That’s the power of styles.

Tags: ,

Bad Behavior has blocked 82 access attempts in the last 7 days.