# $Id: tgr2shp.dbfawk,v 1.3 2005/01/08 09:19:32 we7u Exp $ # # Copyright (C) 2003-2005 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 is used to display Albuquerque shapefiles from # www.cabq.gov, after converting them from NM State Plane coordinats to # Lat/Lon # ogr2ogr -s_srs netcurr.prj -t_srs "EPSG:4326" netcurr_ll.shp netcurr.shp # # NOTE: The City of Albuquerque Public Works department has on occasion changed # the attributes of the roads files, and documents their data terribly. This # file worked properly with the # netcurr shapefile that was on the cabq.gov # site on 30 August 2007. If it is not working with data you have obtained # after that date, please # write to Tom Russo (russo@swcp.com) and let him # know --- they probably changed the DBF columns again. # # 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="FUNCTIONAL:LEFTLOW:LEFTHIGH:RIGHTLOW:RIGHTHIGH:STREETNAME:STREETDESI:STREETQUAD:ALTERNATES:ALTERNATED:len"; #dbffields is which of the above fields we actually want to look at. # No point reading dbffields that are not looked at further. # Let's put functional at end, so we can screen out road names we hate first dbffields="STREETNAME:STREETDESI:STREETQUAD:FUNCTIONAL"; } # 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=0; label_level=0; label_color=8; font_size=0; symbol=""; fill_style=0 } # Get rid of ugly stuff /^STREETNAME=(.+)RAMP/ {next} /^STREETNAME=(.+) ONRP/ {next} /^STREETNAME=(.+) OFRP/ {next} /^STREETNAME=(.+) CONN/ {next} /^STREETNAME=(.+)EASTBOUND/ {name="$1";next} /^STREETNAME=(.+)WESTBOUND/ {name="$1";next} /^STREETNAME=(.+)NORTHBOUND/ {name="$1";next} /^STREETNAME=(.+)SOUTHBOUND/ {name="$1";next} /^STREETNAME=(.+)$/ {name="$1";next} /^STREETDESI=(.+)$/ {name="$(name) $1";next} # Try this to see how it looks: add the quadrant name in /^STREETQUAD=(.+)$/ {name="$(name) $1";next} # Bernalillo county uses TYPE field to designate road type. # The assocuated name is in the MRCOG_FUNC column # The Albuquerque data appears (though this is not documented properly) to use # precisely the same values in the "FUNCTIONAL" field. MRCOG is the "Middle # Region Council of Governments" that appears to have laid down the schema for # such data in this region, so this is a safe guess. # 0: local urban street # 1: undefined # 2: urban Principal Arterial # 3: urban Minor Arterial # 4: urban Collector # 5: urban Local # 6: FWY Frontage # 7: Fwy # 8: FWY on Ramp # 9: Fwy off Ramp # 11: Rural Minor Collector # 12: Rural Principal Arterial # 13: Rural Minor Arterial # 14: Rural Major Collector # 15: Rural Local # 16: Rural Fwy Frontage # 17: Rural Fwy # 18: Rural Fwy on Ramp # 19: Rural Fwy off Ramp # 20: unused # 21: forest roads # 22: minor tribal roads # 23: major tribal roads # 24: Flood Control arcs (AMAFCA and City) # 25: MRGCD ditches and drains # 26: BN & SF Railroad #Type 0 is "local urban streets" /^FUNCTIONAL=0/ {display_level=48; label_level=10; color=8; lanes=1; next} # make forest roads green and dashed, make 2-lane for visibility. /^FUNCTIONAL=21/ {display_level=48; label_level=10; color=2; pattern=1; lanes=2; next} # distinguish minor tribal roads by color (dark gray) /^FUNCTIONAL=22/ {display_level=48; label_level=10; color=7; lanes=1; next} #Freeways and ramps: /^FUNCTIONAL=7$/ {lanes=4; color=4; display_level=8192; label_level=512; font_size=3; next} /^FUNCTIONAL=[8-9]$/ {lanes=2; color=4; display_level=8192; label_level=512; font_size=3; next} #Rural freeways # type /^FUNCTIONAL=1[6-9]$/ {lanes=2; color=8; display_level=8192; label_level=512; font_size=3; next} # they have some major rural roads as "major collector" /^FUNCTIONAL=14$/ {lanes=2; color=8; display_level=8192; label_level=512; font_size=3; next} /^FUNCTIONAL=23$/ {lanes=2; color=7; display_level=8192; label_level=512; font_size=3; next} #Frontage roads # type 6=Urban Interstate Frontage /^FUNCTIONAL=6$/ {lanes=2; color=8; display_level=8192; label_level=96; font_size=1; next} # arterials /^FUNCTIONAL=[2-3]$/ {lanes=2; color=8; display_level=8192; label_level=96; font_size=2; next} /^FUNCTIONAL=1[2-3]$/ {lanes=2; color=8; display_level=8192; label_level=96; font_size=2; next} # Local and collector # type 4=urban collector # type 5=urban local # type 11= rural minor collector # type 15= rural local /^FUNCTIONAL=[4-5]$/ {display_level=96; label_level=16; color=40; lanes=1; next} /^FUNCTIONAL=11$/ {display_level=96; label_level=16; color=40; lanes=1; next} /^FUNCTIONAL=15$/ {display_level=96; label_level=16; color=40; lanes=1; next} # Now the flood control stuff (amafca is "cyan4", MRGCD is "cyan3") /^FUNCTIONAL=24$/ {display_level=48; label_level=10; color=44; lanes=1; pattern=2} /^FUNCTIONAL=25$/ {display_level=48; label_level=10; color=36; lanes=1; pattern=2} #finally the BN&SF railroad /^FUNCTIONAL=26$/ {display_level=8192; label_level=512 color=8; pattern=2; lanes=4; font_size=3}