# $Id$ # # Copyright (C) 2003-2004 The Xastir Group # # This dbfawk file is used to map arbitrary dbf data that accompanies # a shapefile into Xastir canoncical values of: # key - search key # lanes - width of feature (usually a road but applies to rivers, etc. too) # color - color to draw the road # name - name of the road for labels # filled - whether a polygon is drawn filled or not # fill_color - color to fill polygon with # pattern - line pattern for road, river, etc. (0 - solid; 1 - dash; 2 - double dash) # display_level - highest zoom level at which to display the feature # label_level - highest zoom level at which to display the label # symbol - 3 char 'TIO': table, ID, overlay # NOTE: This file format is modeled after awk but is nowhere near awk # compatible. # # This file is used to map roads using the National Atlas roads shapefile. # See the National Atlas data warehouse at # http://www.nationalatlas.gov/atlasftp.html BEGIN { dbfinfo="FNODE_:TNODE_:LPOLY_:RPOLY_:LENGTH:ROADTRL020:FEATURE:NAME:STATE_FIPS:STATE"; #dbffields is which of the above fields we actually want to look at. # No point reading dbffields that are not looked at further. dbffields="FEATURE:NAME"; } # BEGIN_RECORD is called once per dbf record which contains multiple fields. # Use this rule to re-initialize variables between records. # use color 11 to highlight stuff that isn't properly mapped. BEGIN_RECORD {key=""; lanes=1; color=8; fill_color=11; name=""; filled=0; pattern=0; display_level=80000; label_level=32; label_color=8; font_size=0; symbol=""; fill_style=0 } # Limited access highways are all major /^FEATURE=Limited Access Highway/ {lanes=4; color=4; label_level=512; font_size=3;} /^FEATURE=Other Through Highway/ {lanes=3; color=8; display_level=256; label_level=256; font_size=2;} /^FEATURE=Principal Highway/ {lanes=3; color=8; display_level=256; label_level=256; font_size=2;} /^FEATURE=Other Highway/ {lanes=2; color=8; display_level=128; label_level=128; font_size=1;} /^FEATURE=Ferry Crossing/ {lanes=2;color=26; display_level=128; pattern=2; font_size=1; next} /^FEATURE=(.*)Alternate Route/ {pattern=1} /^FEATURE=(.*)In Tunnel/ {pattern=2} # Now the names. Unfortunately, the National Atlas file lumps all the # names for one road in one DBF field, and we have no easy way to pick # them out separately. So here's what we'll do: # Pick out the first one: /^NAME=State Route ([^,]*)/ {name="SR $1";} /^NAME=Alternate State Route ([^,]*)/ {name="SR $1(ALT)";} /^NAME=US Route ([^,]*)/ {name="US $1";} /^NAME=Alternate US Route ([^,]*)/ {name="US $1(ALT)";} /^NAME=Interstate Route ([^,]*)/ {name="I$1";} /^NAME=Alternate Interstate Route ([^,]*)/ {name="I$1(ALT)";} # Now the second one /^NAME=[^,]*, State Route ([^,]*)/ {name="$(name)/SR $1";} /^NAME=[^,]*, Alternate State Route ([^,]*)/ {name="$(name)/SR $1(ALT)";} /^NAME=[^,]*, US Route ([^,]*)/ {name="$(name)/US $1";} /^NAME=[^,]*, Alternate US Route ([^,]*)/ {name="$(name)/US $1(ALT)";} /^NAME=[^,]*, Interstate Route ([^,]*)/ {name="$(name)/I$1";} /^NAME=[^,]*, Alternate Interstate Route ([^,]*)/ {name="$(name)/I$1(ALT)";} #and the third /^NAME=[^,]*, [^,]*, State Route ([^,]*)/ {name="$(name)/SR $1";} /^NAME=[^,]*, [^,]*, Alternate State Route ([^,]*)/ {name="$(name)/SR $1(ALT)";} /^NAME=[^,]*, [^,]*, US Route ([^,]*)/ {name="$(name)/US $1";} /^NAME=[^,]*, [^,]*, Alternate US Route ([^,]*)/ {name="$(name)/US $1(ALT)";} /^NAME=[^,]*, [^,]*, Interstate Route ([^,]*)/ {name="$(name)/I$1";} /^NAME=[^,]*, [^,]*, Alternate Interstate Route ([^,]*)/ {name="$(name)/I$1(ALT)";} # We won't bother if there's a fourth.