[Xastir-Dev] proposed method of doing canoncial shapefile DBF attributes support

Alan Crosswell alan at columbia.edu
Fri Jun 27 11:36:44 EDT 2003


OK, so I guess attachments get broken.  Here it is inline:

Use a metadata file for each map that translates map-specific fields into
canonical fields.  When the metadata file is missing, guess at which one
of several pre-defined metadata definitions to use based on the dbf
"signature" (as the code does currently).

Let's try a sample file (use Tiger/line since they are the most complicated):

Use awk subset syntax.  Implement patterns using the pcre(3) library.
pattern { action}

Action grammar is:
<attr> := "width" | "color" | "name" | "filled" | "pattern"
           | "display_level" | "label_level"
<attr_set> := <attr> "=" value
<op>   := "next"   # like awk, to end pattern search
<stmt> := <attr_set> | <op>
<stmt_list> := <stmt_list> ";" <stmt> | <stmt>
<action> := <stmt_list>

Read DBF fields and pass them to this function as
<field>=value

Sample file for Tiger/Line:
# see tig2aprs.c cfccrange() for related examples.  See Tiger/Line
# technical documentation for complete list of codes.
# set defaults:  empty pattern matches everything.
{key=""; width=1; color=black; name=""; filled=0; pattern=solid;
  display_level=8192; label_level=32}
# set the search key to be the Tiger/Line ID.  Not currently used.
/^TLID=\(.*\)$/ {key=$1}
# set the label to be the Feature Name
/^FENAME=United States Highway\(.*\)$/ {label="US $1"};
/^FENAME=State Highway\(.*\)$/ {label="State $1"};
/^FENAME=State Route\(.*\)$/ {label="SR $1"};
/^FENAME=\(.*\)$/ {label=$1}
# Census Feature Class Code
# A: roads
/^CFCC=A1/ {lanes=4; color=brown}
/^CFCC=A2/ {lanes=3; color=black}
/^CFCC=A3[1-6]/ {display_level=256; next}
/^CFCC=A3[7-8]/ {display_level=128; next}
/^CFCC=A3/ {lanes=2; color=black}
/^CFCC=A4/ {display_level=96; label_level=16; color=gray35; lanes=1}
/^CFCC=A5/ {lanes=2; color=gray35; display_level=64}
/^CFCC=A65/ {lanes=2, color=black, pattern=dashed; next}
/^CFCC=A6[^5]/ {color=gray35; display_level=64; next}
/^CFCC=A7[12]/ {lanes=1; color=red; pattern=dashed; display_level=64; next}
/^CFCC=A7[03-9]/ {lanes=1; color=gray35; pattern=dashed; display_level=64; next}
# need to implement these:
# B: railroads
# C: transmission lines
# D: landmarks
# E: physical featuers
# F: county boundaries
# (G not used by census;  tig2aprs uses for special maps)
# H: hydrography
/^CFCC=H0/ {lanes=0; color=Steelblue;}
/^CFCC=H02/ {pattern=dashed; next}
/^CFCC=H[1-6]2/ {lanes=1; pattern=dashed; next}
/^CFCC=H[1-6][013-9] {lanes=1; next}
/^CFCC=H7/ {display_level=0; label_level=0; next}
/^CFCC=H8/ {color=steelblue; lanes=1}
/^CFCC=H81/ {color=white; next}


Alan Crosswell wrote:
> What do you think:
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xastir-dev mailing list
> Xastir-dev at xastir.org
> https://krypton.hscs.virginia.edu/mailman/listinfo/xastir-dev



More information about the Xastir-dev mailing list