[Xastir-dev] national highway planning network dbfawk file... almost

Derrick J Brashear shadow at dementia.org
Wed Oct 6 11:01:11 EDT 2004


wiki.findewe.com doesn't seem to answer. anyway, as before, this is the 
2004 national transportation atlas. 
(https://www.bts.gov/pdc/user/products/src/products.xml?p=1802&c=-1)

as a first pass i spent a few minutes on a dbfawk file for the highway 
layer. but... i'm seeing fonts larger than i expect creeping in somehow, 
and fonts not consistent with the road sizes that get drawn. am i screwing 
up somewhere obvious?
-------------- next part --------------
# $Id: tgr2shp.dbfawk,v 1.1 2004/04/08 16:14:15 we7u Exp $
#
# Copyright (C) 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.
#

# BEGIN is called once per dbf file which contains multiple records.
BEGIN {
# dbfinfo is the "signature" of the dbf file listing the column names in order.
# dbfinfo should match the dbf file that we say this dbfawk file goes with.
dbfinfo="RECTYPE:VERSION:RECID:ORIGID:CTFIPS:SOURCE:LGURB:SMURB:SIGN1:SIGNT1:SIGNN1:SIGNQ1:SIGN2:SIGNT2:SIGNN2:SIGNQ2:SIGN3:SIGNT3:SIGNN3:SIGNQ3:LNAME:MILES:KM:FCLASS:RUCODE:STATUS:NHS:STRAHNET:FAC_ID:CONN_ID:CONN_DES:CONN_MILES:LRSKEY:LRSSEQ:BEGMP:ENDMP:FIPS:BTSVERSION:REVISION";
#dbffields is which of the above fields we actually want to look at.
# No point reading dbffields that are not looked at further.
dbffields="SIGN1:SIGN2:SIGN3:LNAME:FCLASS:STATUS:RECID";
}

# 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=96; label_level=16; label_color=8; font_size=0; symbol=""; fill_style=0 }

# ignore unopened roads
/^STATUS=0$/ { skip }

# per-field rules are applied to the dbffields that are read from each record.
# key: set the search key to be the Tiger/Line ID.  Not currently used.
/^RECID=(.*)$/ {key=$1; next}

/^SIGN1=(.*)$/ {name="$1"; next}
/^SIGN2=(.*)$/ {name="$(name) $1"; next}
/^SIGN3=(.*)$/ {name="$(name) $1"; next}
/^LNAME=(.*)$/ {name="$(name) $1"; next}

# 01 - Rural Principal Arterial - Interstate
# 02 - Rural Principal Arterial - Other
# 06 - Rural Minor Arterial
# 07 - Rural Major Collector
# 08 - Rural Minor Collector
# 09 - Rural Local
# 11 - Urban Principal Arterial - Interstate
# 12 - Urban Principal Arterial - Other Freeways & Expressways
# 14 - Urban Principal Arterial - Other
# 16 - Urban Minor Arterial
# 17 - Urban Collector
# 19 - Urban Local
# 0 - Bug?

/^FCLASS=01$/ {lanes=4; color=4; label_level=512; font_size=3; next}
/^FCLASS=11$/ {lanes=4; color=4; label_level=512; font_size=3; next}

/^FCLASS=12$/ {lanes=3; color=4; label_level=512; font_size=3; next}

/^FCLASS=02$/ {lanes=3; color=8; label_level=256; font_size=2; next}
/^FCLASS=14$/ {lanes=3; color=8; label_level=256; font_size=2; next}

/^FCLASS=06$/ {lanes=2; color=8; label_level=128; font_size=1; next}
/^FCLASS=07$/ {lanes=2; color=8; label_level=128; font_size=1; next}
/^FCLASS=08$/ {lanes=2; color=8; label_level=128; font_size=1; next}
/^FCLASS=16$/ {lanes=2; color=8; label_level=128; font_size=1; next}
/^FCLASS=17$/ {lanes=2; color=8; label_level=128; font_size=1; next}

/^FCLASS=09$/ {lanes=1; color=40; label_level=16; display_level=96; font_size=0; next}
/^FCLASS=19$/ {lanes=1; color=40; label_level=16; display_level=96; font_size=0; next}

/^FCLASS=(.*)$/ {lanes=1; color=40; label_level=16; display_level=96; font_size=0; name="$name $1"; next}

font_size=0;

# just a demo of the END_RECORD and END rules:
#END_RECORD {name="$name ($key)";}
#END {}


More information about the Xastir-dev mailing list