Map Plotting
Most WXP graphics programs plot Maps. By default, the wxp.map file plots for plot domains over North America. Otherwise, the program will draw a map based on the cont.dat and country.dat files. If another map is needed, the map_file resource is used to specify a list of maps to plot. The filenames listed by the resource can be specified as a relative path in which the value of the file_path resource is prepended to the filename or as a full path to avoid the file_path setting.
WXP comes with a rather large set of map databases, all of which can be used to enhance plots. Here is a list of the basic set of maps:
- wxp.map - the standard low resolution map of North America (default for most plots)
- cont.map - low resolution global continental outline map (default for non-N.A. plots)
- country.map - low resolution political outline map (default for non-N.A. plots)
- state.map - high resolution U.S. state outline map
- wxpstate.map - low resolution state outline (derived from wxp.map) for use with cont.map.
- usa_cnty.map - medium accuracy county outline map.
- zones.map - forecast zone map.
There are binary versions of some of these maps created with the map2bin program. These will have a .bmap extension.
DLG (Digital Line Graph) Maps
There is an optional set of maps derived from the USGS DLG databases. These are high resolution maps containing outlines of:
- country and coast lines
- state outlines
- county outlines (these are exclusive boundaries so you need to plot all three of these).
- roads
- railroads
- streams
- lakes and islands
- major city outlines
- national parks, monuments, forests
- Indian reservations
- military reservations
All of these maps are in binary format due to the resolution and resultant size of the maps. The WXP distribution comes with these maps:
- dlg/nation.bmap
- dlg/coast.bmap
- dlg/state.bmap
- dlg/cnty.bmap
- dlg/rd_int.bmap (Interstate highways)
- dlg/rd_us.bmap (US highways)
- dlg/rd_state.bmap (selected state highways)
Multiple Maps and Attributes
The map_file resource allows you to specify more than one map if the map file names are separated by a comma. The maps are drawn in the order listed.
-mf=cont.map,country.map
You can specify as many maps as you want but remember, the plot will get rather cluttered if more than 3 are specified.
In order to distinguish multiple maps, it may be necessary to change the color and style of each of the maps. You can add attributes:
-mf=cont.map:co=lred:wi=2,country.map:co=red
In this example, the first map is drawn in light red with a line width of 2. The second map is drawn in red.
Map List Files
If the command line gets to compilcated, the map file specification can be put into a file. The above line would look like:
cont.map:co=lred:wi=2
country.map:co=red
In a file named "globe.mpl". Each map is on a different line, not separated by commas as with the resource specification. The file will be listed in the map_file resource as:
-mf=fi:globe.mpl
Conditional Map Drawing
This is the ability to toggle the drawing of maps on and off based on the region of the world and the size of the domain. As the user zooms in on a region, the maps that are drawn will change to add more detail if needed.The criteria for toggling maps are based on domain size. The domain size is determined by the following formula:
size = (ny-1)*dy
Ny and Dy are from the plot_domain specification. For example the us
domain (as listed in the wxp.reg file) is a 25x17 grid with a spacing of 2.3.
This makes the domain size 16*2.3 or 36.8. Here is a table of domain sizes and
what they represent
- 200 - hemispheric
- 100 - continental
- 40 - scale of contiguous U.S.
- 15-20 - small U.S. regions
- 10 - 1 to 3 states
- 5 - sub-state scale
You can make the map conditional by putting a ">size" or a "<size" in front of the map file name to specify whether the map is drawn if the domain is greater than size or less than size, respectively. Here is a sample:
>20:wxp.map <10:dlg/cnty.bmap:co=red <20:dlg/nation.bmap:co=lred:wi=2 <20:dlg/state.bmap:co=lred:wi=2 <20:dlg/coast.bmap:co=lred:wi=2 <10:dlg/rd_int.bmap:co=brown <3:rf:counties.raw-Name:co=cyan:te=.75
Now remember order is critical. In some cases, you may want a map to draw last so it is not obscured. In this case, I want the interstate highway map to draw on top so it is the most visible. Of course, the interstate map will only draw for state scale domains (size<10). The low resolution wxp.map is replaced by the higher resolution DLG maps at a size of 20. The last line listed is not a map at all but a raw file. This will label each county with its name for very small domains. The counties.raw file has several fields in it but we want to only plot the Name field from that file.
You can combine the "<" and ">" to plot a map within a specified range:
>5<10:range.map
Regional Map Drawing
This is the second component of conditional drawing. The DLG databases are only valid over the contiguous U.S. so these map files make no sense if you are drawing a map for Europe. Regional drawing limits a set of maps to a specific region. The region limits are specified on a line with the brackets [ ]:
[25,50,-125,-75,75] >20:wxp.map <10:dlg/cnty.bmap:co=red <20:dlg/nation.bmap:co=lred:wi=2 <20:dlg/state.bmap:co=lred:wi=2 <20:dlg/coast.bmap:co=lred:wi=2 <10:dlg/rd_int.bmap:co=brown <3:rf:counties.raw-Name:co=cyan:te=.75 [] cont.map country.map
The five numbers of the region limits are the minimum and maximum latitudes, the minimum and maximum longitudes and the maximum domain size. This set of maps (between region specifications) will be drawn if the central latitude and longitude (from the plot_domain resource) is within the range specified and the domain size is less than the maximum size. The domain size is optional. More than one like this can be specified in the map specification file. The blank bracket specification denotes the default set of maps. If the domain matches none of the criteria, the default set of maps is drawn. This must be specified last.
Plotting non-maps
The map_file resource allows the users to plot non-map files.
- lalo:lat[:lon]
Draw lat-lon lines at the specified interval. This allows the user to control the order and when lat-lon lines are drawn. If lon is omitted, the interval for both is the same. - rf:rawfile[-variable]
Plots the contents of the raw file This is handy for labeling maps with city and county names. - im:image[:back:x:y]
This overlays an image on the plot. The image is a GIF image that can be created by WXP or another program and saved in the file image. The value of the image_path resource is prepended to the filename if a relative path.
The back specifies a color that will be transparent. The default is black. If this plot is a reverse/inverted color (white background), the map image may have to be plotted in black in which case you would use white for the transparent color.
The x:y specifies an offset for the image. By default, it is placed relative to the upper left corner of the plotting window. You can offset this positive which is relative to the upper left corner of negative which is relative to the lower right corner.
An example:
-mf=im:earth_us.gif,+im:wxplogo.gif::-1:-1 -ge=540x400
This plots two images, the first being a relief map of the U.S. and the second being a logo placed on the map in the lower right identifying the plot as being plotted by WXP.
NOTE: when dealing with image background maps, it may be necessary to fix the size of the plot to match the size of the image. - if:image[:back:x:y]
This overlays an image much like im: except the image is offset from the upper left corner of the window, not the plot. - mf:metafile
This plots the content of a metafile.
Underlay, Overlay Maps
The map drawing is done in two ways; as an underlay and as an overlay. For most plotting, the map is an underlay. For color fill contouring, satellite and radar display, the map is an overlay. To control how a map is plotted either as an underlay or an overlay, add either a "-" for underlay or a "+" for overlay:
-im:usa_relief.gif
wxp.map
+im:wxplogo.gif::-1:-1
The image "usa_relief.gif" will always be plotted as an underlay. The WXP logo will always be plotted as an overlay in the lower right hand corner. In this case we are putting relief image under the plot and a logo over the plot. The "wxp.map" will plot either as an underlay or an overlay depending on the default for the type of plot.
Latitude Longitude Lines
Each of the graphics programs can display latitude-longitude lines on top of the geographical map. These lines can be drawn at any specific interval. The lines are labeled at the left and bottom of the plot. The syntax is:
- lalo:lat[:lon:plus:extra]
where the latitude spacing is lat and longitude is lon. If lon is not specified, it is set to lat. The attributes of these lines are controlled by the color_line resource.
Plus represents whether small plus signs "+" are placed at lat,lon intersections where plus is the interval between pluses. Extra represents where extra lat, lon labels are to be placed where extra is the interval between labels. These labels are offset from prime lines such as the equator and date line. For example, if extra is 45, then the labels are placed at -67.5, -22.5, 22.5 and 67.5.
Binary map file interface
The mapping programs take binary data files for speed. There is a program called map2bin which converts the map files into a binary form WXP can handle. WXP automatically senses when it is using a binary map file. Binary map files plot up to 5 times faster.
For further information about WXP, email devo@ks.unisys.com
Last updated by Dan Vietor on July 21, 1998