dbfawk variable | use |
---|---|
color | sets the color of lines drawn (see below) |
lanes | sets width of lines drawn |
name | sets the text that will be used as the label for the feature |
symbol | sets the symbol that will be used for point data (using group/symbol/overlay specification) |
fill_style | sets fill style per XSetFillStyle man page. 0=solid (default), 2=stippled (as used for weather alerts). 1 is "tiled"? and 3 is "Opaque Stippled"? |
fill_color | sets color used to fill area features --- uses same numbers as color variable (below) |
fill_style | chooses fill style. At this time only 0 and 2 are worth using. 0 is "solid" and "2" is stippled, per XSetFillStyle. See below. |
fill_stipple | When fill_style is 2, chooses stipple pattern. 0 is a 13 percent stipple, 1 is 25%, 2 is 50%. |
pattern | sets line pattern. 0=solid, 1=dashed, 2="double dash" (per XSetLineAttributes) |
display_level | sets zoom above which the feature will be stop being displayed |
label_level | sets zoom above which labels will be stop being displayed |
label_color | sets color of labels. (see section on selecting colors, below) |
font_size | chooses font size. (0="Tiny", 4="Huge", per settings in Map->Configure->Map label fonts menu) |
Given a shapefile and associated DBF file with attributes:
> dbfinfo /usr/local/share/xastir/maps/misc_vector/USFS_SandiaRD 67 Columns, 544 Records in file FNODE_ integer (11,0) TNODE_ integer (11,0) LPOLY_ integer (11,0) RPOLY_ integer (11,0) LENGTH float (31,15) TRAIL_ integer (11,0) TRAIL_ID integer (11,0) TYPE string (1,0) CODE string (2,0) CODE_MEMO string (80,0) METHOD string (2,0) MISC string (1,0) TE_UNIT string (1,0) EXISTVEG string (1,0) FS_OWN string (1,0) TRAIL string (1,0) ROAD string (1,0) WATER string (1,0) STREAM string (1,0) PLSS string (1,0) ADM_DIST string (1,0) ADM_UNIT string (1,0) PASTURE string (1,0) SPEC_MGT string (1,0) HRTGSRVY string (1,0) RD_RTE_NO string (35,0) TR_RTE_NO string (35,0) STRM_NAME string (80,0) SURVEY_NUM string (13,0) CFF1 string (3,0) CFF2 string (3,0) CFF3 string (3,0) CFF4 string (3,0) CFF5 string (3,0) CFF6 string (3,0) CFF7 string (3,0) CFF8 string (3,0) CFF9 string (3,0) CFF10 string (3,0) NUMBER string (35,0) NUMBER0 string (35,0) LEVE string (20,0) TYPE0 string (20,0) ROAD_TYPE string (20,0) LANES string (20,0) SURFACE string (20,0) PROBLEM string (20,0) CLOSURE string (20,0) DATE integer (8,0) TIME string (20,0) OPERATOR string (20,0) COMMENTS string (50,0) MAX_PDOP float (31,15) GPS_DATE integer (8,0) GPS_TIME string (20,0) GPS_LENGTH float (31,15) HORZ_PREC float (31,15) VERT_PREC float (31,15) HORZ_PRE0 float (31,15) VERT_PRE0 float (31,15) TRAIL_NO string (10,0) SOURCE string (10,0) MAPUSE string (25,0) NAME string (30,0) MILES2 float (23,16) COOID string (10,0) STATUS integer (11,0)This list of attributes will be used in the DBFAWK file to recognize files to which the dbfawk file applies.
It is also possible to use "testdbfawk" that is built in the xastir source tree when you compile xastir with DBFAWK enabled.
Prior to CVS versions of 24 September 2008, "testdbfawk" was called "testawk" and the Xastir install process didn't install the program, leaving it built but uninstalled in the "src" directory. Users of these older versions of Xastir will have to build the code and execute testawk from its non-system location in the build directory.
> testdbfawk -D /usr/local/share/xastir/config -d /usr/local/share/xastir/maps/misc_vector/USFS_SandiaRD 67 Columns, 544 Records in file sig: FNODE_:TNODE_:LPOLY_:RPOLY_:LENGTH:TRAIL_:TRAIL_ID:TYPE:CODE:CODE_MEMO:METHOD:MISC:TE_UNIT:EXISTVEG:FS_OWN:TRAIL:ROAD:WATER:STREAM:PLSS:ADM_DIST:ADM_UNIT:PASTURE:SPEC_MGT:HRTGSRVY:RD_RTE_NO:TR_RTE_NO:STRM_NAME:SURVEY_NUM:CFF1:CFF2:CFF3:CFF4:CFF5:CFF6:CFF7:CFF8:CFF9:CFF10:NUMBER:NUMBER0:LEVE:TYPE0:ROAD_TYPE:LANES:SURFACE:PROBLEM:CLOSURE:DATE:TIME:OPERATOR:COMMENTS:MAX_PDOP:GPS_DATE:GPS_TIME:GPS_LENGTH:HORZ_PREC:VERT_PREC:HORZ_PRE0:VERT_PRE0:TRAIL_NO:SOURCE:MAPUSE:NAME:MILES2:COOID:STATUS [etc.]
dbfinfo="FNODE_:TNODE_:LPOLY_:RPOLY_:LENGTH:TRAIL_:TRAIL_ID:TYPE:CODE:CODE_MEMO:METHOD:MISC:TE_UNIT:EXISTVEG:FS_OWN:TRAIL:ROAD:WATER:STREAM:PLSS:ADM_DIST:ADM_UNIT:PASTURE:SPEC_MGT:HRTGSRVY:RD_RTE_NO:TR_RTE_NO:STRM_NAME:SURVEY_NUM:CFF1:CFF2:CFF3:CFF4:CFF5:CFF6:CFF7:CFF8:CFF9:CFF10:NUMBER:NUMBER0:LEVE:TYPE0:ROAD_TYPE:LANES:SURFACE:PROBLEM:CLOSURE:DATE:TIME:OPERATOR:COMMENTS:MAX_PDOP:GPS_DATE:GPS_TIME:GPS_LENGTH:HORZ_PREC:VERT_PREC:HORZ_PRE0:VERT_PRE0:TRAIL_NO:SOURCE:MAPUSE:NAME:MILES2:COOID:STATUS";
dbffields="CFF1:NAME:TRAIL_NO";This selects the feature code (CFF), name and trail number.
NOTE: THE SEMICOLON AT THE END OF DBFFIELDS IS REQUIRED due to a bug in the dbfawk parser. Leaving it off will cause dbfawk to mis-parse the dbffields variable to include all characters up to the closing brace in the BEGIN block. This bug is hidden if there *are* no characters between the closing quote and brace, but mysteriously shows up if there is a newline. So just put a semicolon at the end for correctness.
# Use this rule to re-initialize variables between records. # These will be your defaults # My defaults are "1 lane, color brown, pattern "LineDoubleDash" (see the # XSetLineAttributes man page), always display the line, display labels if # zoomed in to level 32 or smaller, black labels, large font) # The defaults are overridden by specific rules below BEGIN_RECORD {key=""; lanes=1; color=4; name=""; filled=0; pattern=2; display_level=1; label_level=32; label_color=8; symbol=""; font_size=3} # hiking trails and unimproved roads # This sets the color of the line and pattern based on the feature type # We don't bother showing hiking trails if zoomed out farther than 128 # brown for hiking trails /^CFF1=107$/ {lanes=2; color=69; pattern=1;display_level=128;} # dashed steel blue lines for class 4 unimproved roads. /^CFF1=106*$/ {lanes=2; color=26; pattern=1;display_level=128;} # Now look for a name number and/or trail number # Never display "UNK" as a trail name /^NAME=[uU][nN][kK]$/ {skip;} /^TRAIL_NO=[uU][nN][kK]$/ {skip;} # select the name given in the record /^NAME=(.+)$/ {name="$1";} # and append the trail number to the name /^TRAIL_NO=(.+)$/ {name="$name (Tr. $1)";}In this example I set most variables to some default at the beginning of each DBF record, and then look for particular patterns. The USFS maps have an attribute called "CFF1" (CFF stands for Cartographic Feature File) that contains an ID code for the feature type of the corresponding shape. CFF=107 means it's a hiking trail, so I set the zoom level at which the trail will show up to 128, the color to 69 (which is mapped to "brown1" in main.c), and 2 "lanes" that last seems odd, but I found that at zoom level 128 my background rasters always seemed to make "one lane" trails invisible.
Hex value | decimal | Color (as X11 calls it) |
---|---|---|
0x00 | 0 | DarkGreen |
0x01 | 1 | purple |
0x02 | 2 | DarkGreen |
0x03 | 3 | cyan |
0x04 | 4 | brown |
0x05 | 5 | plum |
0x06 | 6 | orange |
0x07 | 7 | darkgray |
0x08 | 8 | black |
0x09 | 9 | blue |
0x0a | 10 | green |
0x0b | 11 | mediumorchid |
0x0c | 12 | red |
0x0d | 13 | magenta |
0x0e | 14 | yellow |
0x0f | 15 | white |
0x10 | 16 | black |
0x11 | 17 | black |
0x12 | 18 | black |
0x13 | 19 | black |
0x14 | 20 | lightgray |
0x15 | 21 | magenta |
0x16 | 22 | mediumorchid |
0x17 | 23 | lightblue |
0x18 | 24 | purple |
0x19 | 25 | orange2 |
0x1a | 26 | SteelBlue |
0x20 | 32 | white |
0x21 | 33 | black |
0x22 | 34 | blue |
0x23 | 35 | green |
0x24 | 36 | cyan3 |
0x25 | 37 | red |
0x26 | 38 | magenta |
0x27 | 39 | yellow |
0x28 | 40 | gray35 |
0x29 | 41 | gray27 |
0x2a | 42 | blue4 |
0x2b | 43 | green4 |
0x2c | 44 | cyan4 |
0x2d | 45 | red4 |
0x2e | 46 | magenta4 |
0x2f | 47 | yellow4 |
0x30 | 48 | gray53 |
0x40 | 64 | yellow |
0x41 | 65 | DarkOrange3 |
0x42 | 66 | purple |
0x43 | 67 | gray80 |
0x44 | 68 | red3 |
0x45 | 69 | brown1 |
0x46 | 70 | brown3 |
0x47 | 71 | blue4 |
0x48 | 72 | DeepSkyBlue |
0x49 | 73 | DarkGreen |
0x4a | 74 | red2 |
0x4b | 75 | green3 |
0x4c | 76 | MediumBlue |
0x4d | 77 | white |
0x4e | 78 | gray53 |
0x4f | 79 | gray35 |
0x50 | 80 | gray27 |
0x51 | 81 | black |
0x52 | 83 | LimeGreen |
0x60 | 96 | HotPink |
0x61 | 97 | RoyalBlue |
0x62 | 98 | orange3 |
0x63 | 99 | yellow3 |
0x64 | 100 | ForestGreen |
0x65 | 101 | DodgerBlue |
0x66 | 102 | cyan2 |
0x67 | 103 | plum2 |
0x68 | 104 | MediumBlue |
0x69 | 105 | gray86 |
0xfe | 254 | pink |