# $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 Bernalillo County road shapefiles from # www.bernco.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 Bernalillo County Public Works department has on occasion changed # the attributes of the roads files. This file worked properly with the # netcurr shapefile that was on the bernco.gov site on 4 April 2006. 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="StreetName:StreetDes:Suffix:FromStreet:ToStreet:NMDOTName:SurfaceTyp:MaintBy:MaintFlag:CountyID:Segmentati:PaveCond:Dedicated:PaveWidth:RightOfWay:SpeedLimit:FuncClass:MaintDist:Owner:Jurisdicti:Subdivisio:MaintFor:PaveRating:YearBuilt:AddDate:DropDate:YearBuiltS:ProjectFun:LinearCost:ActionNote:GASB:SurfMaintB:Lanes:Miles:LaneMiles:FullName:SHAPE_Leng"; #dbffields is which of the above fields we actually want to look at. # No point reading dbffields that are not looked at further. dbffields="StreetName:StreetDes:Suffix:FuncClass"; } # 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} /^StreetDes=(.+)$/ {name="$(name) $1";next} /^Suffix=(.+)$/ {name="$(name) $1";next} # Bernalillo county uses TYPE field to designate road type. # The assocuated name is in the MRCOG_FUNC column # 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" /^FuncClass=0/ {display_level=48; label_level=10; color=8; lanes=1; next} # make forest roads green and dashed, make 2-lane for visibility. /^FuncClass=21/ {display_level=48; label_level=10; color=2; pattern=1; lanes=2; next} # distinguish minor tribal roads by color (dark gray) /^FuncClass=22/ {display_level=48; label_level=10; color=7; lanes=1; next} #Freeways and ramps: /^FuncClass=7$/ {lanes=4; color=4; display_level=8192; label_level=512; font_size=3; next} /^FuncClass=[8-9]$/ {lanes=2; color=4; display_level=8192; label_level=512; font_size=3; next} #Rural freeways # type /^FuncClass=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" /^FuncClass=14$/ {lanes=2; color=8; display_level=8192; label_level=512; font_size=3; next} /^FuncClass=23$/ {lanes=2; color=7; display_level=8192; label_level=512; font_size=3; next} #Frontage roads # type 6=Urban Interstate Frontage /^FuncClass=6$/ {lanes=2; color=8; display_level=8192; label_level=96; font_size=1; next} # arterials /^FuncClass=[2-3]$/ {lanes=2; color=8; display_level=8192; label_level=96; font_size=2; next} /^FuncClass=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 /^FuncClass=[4-5]$/ {display_level=96; label_level=16; color=40; lanes=1; next} /^FuncClass=11$/ {display_level=96; label_level=16; color=40; lanes=1; next} /^FuncClass=15$/ {display_level=96; label_level=16; color=40; lanes=1; next} # Now the flood control stuff (amafca is "cyan4", MRGCD is "cyan3") /^FuncClass=24$/ {display_level=48; label_level=10; color=44; lanes=1; pattern=2} /^FuncClass=25$/ {display_level=48; label_level=10; color=36; lanes=1; pattern=2} #finally the BN&SF railroad /^FuncClass=26$/ {display_level=8192; label_level=512 color=8; pattern=2; lanes=4; font_size=3}