[Xastir] OSM Example DBFAWK File

John Ronan jpronans at gmail.com
Thu Jul 8 04:54:43 EDT 2010


Hi, 
I've a few dbfawk's done.  The OSM patches were released before I got back to looking at them further.


http://www.ei7ig.org/xastir/dbfawk/

I must have neglected to post the link to the list previously, apologies

Regards
de John
EI7IG

On 8 Jul 2010, at 09:33, Curt, WE7U wrote:

> On Thu, 8 Jul 2010, James Ewen wrote:
> 
>> So, you state that you would like to have better looking maps, and you
>> hate the existing esoteric dbfawk files, but then sum it up by giving
>> up and just asking someone else to create a dbfawk file that may or
>> may not make things look the way you like, and even at that not have
>> the ability to render the final image in a visually pleasing manner?
> 
> I haven't had time to look at dbfawk's for OSM Shapefiles (until
> just now), but figured somebody would get around to it sooner or
> later.  What will happen is this:  Somebody will spend the time to
> do it and get Xastir to render the maps.  Somebody else will come
> along and say: "Why don't the maps look like, or as nice as, the
> ones we get online in raster format?".  That has happened with
> Tigermaps in the past.
> 
> The good news is that I just went here (found the link in an earlier
> message to the Xastir list by yours truly):
> 
>    http://wiki.openstreetmap.org/wiki/Shapefiles
> 
> and downloaded the Cloudmade Shapefiles for North
> America/USA/Washington in the form of "washington.shapefiles.zip"
> (at 58.8 MB).  Unzipped into my maps directory, indexed new maps in
> Xastir, and I have blazingly fast vector OSM maps in Xastir.  Of
> course no labels on anything yet (one of the limitations of
> Shapefiles is that there is no standard for the "DBF" file
> order/contents).
> 
> So...  With a small amount of time I should be able to run a few
> commands like:
> 
>    > dbfinfo washington_highway.shp | head
>    Info for washington_highway.shp
>    4 Columns,  343960 Records in file
>               TYPE          string  (20,0)
>               NAME          string  (115,0)
>             ONEWAY          string  (10,0)
>              LANES         integer  (11,0)
> 
> Then write up a quick dbfawk for each that will display the files in
> the correct font size, colors, etc.  "dbfinfo" is from the
> shapelib/contrib directory and I've had that installed for years.
> 
> What is needed by any interested parties in doing the same, or
> improving the dbfawk work done by others:  Shapelib:
> Install & compile, including the contrib area.  Text editor of your
> choice.  Simple huh?
> 
> Here's Tom's dbfawk tutorial:
> 
>    http://pages.swcp.com/~russo/shape_web/tutorial.html
> 
> and the Xastir Wiki page that I think he's moving it to (the Wiki
> link listed in the above tutorial page is wrong):
> 
>    http://www.xastir.org/wiki/HowTo:DBFAWK
> 
> Included below is the "washington_highway.dbfawk" file I just
> created.  I couldn't get the "lanes" variable set properly from the
> "LANES" field in the dbf file, so I hard-coded the values.  Perhaps
> someone can take this example file, "pretty it up" a bit, fix the
> few problems, and duplicate/extend it for the rest of the Shapefiles
> available from the OSM Shapefiles download area.
> 
> Have fun, and please remember to contribute you mods back to the
> group so that everyone can benefit!
> 
> -- 
> Curt, WE7U.                         <http://www.eskimo.com/~archer>
>   APRS:  Where it's at!                    <http://www.xastir.org>
>  Lotto:  A tax on people who are bad at math. - unknown
> Windows:  Microsoft's tax on computer illiterates. - WE7U.
> The world DOES revolve around me:  I picked the coordinate system!"
> 
> 
> ---------------------------------------------------------------------
> # $Id: $
> #
> # Copyright (C) 2003-2010  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 OSM shapefiles by "Cloudmade" which are
> # named "*_highway.dbf".
> 
> # 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="TYPE:NAME:ONEWAY:LANES";
> 
> # dbffields is which of the above fields we actually want to look at.
> # No point reading dbffields that are not looked at further.
> dbffields="TYPE:NAME:ONEWAY:LANES";
> }
> 
> # 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=8192; label_level=32; label_color=8; font_size=0; symbol=""}
> 
> # per-field rules are applied to the dbffields that are read from
> # each record.
> 
> # select the name given in the record
> /^NAME=(.+)$/ {name="$1";}
> #/^LANES=(.+)$/ {lanes="$1";}
> 
> # TYPE:
> /^TYPE=abandoned/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=bridleway/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=construction/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=crossing/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=cycleway/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=driveway/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=footway/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=ford/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=living_street/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> # Note:  No display_level
> /^TYPE=motorway/ {lanes=3; color=2; label_level=512; font_size=3; next}
> # Note:  No display_level
> /^TYPE=motorway_link/ {lanes=3; color=2; label_level=16; font_size=3; next}
> /^TYPE=path/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=pedestrian/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=platform/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=primary/ {lanes=2; color=8; display_level=512; label_level=32; font_size=1; next}
> /^TYPE=primary_link/ {lanes=2; color=8; display_level=512; label_level=32; font_size=1; next}
> /^TYPE=raceway/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=ramp/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=residential/ {lanes=1; color=7; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=road/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=secondary/ {lanes=1; color=8; display_level=256; label_level=16; font_size=1; next}
> /^TYPE=secondary_link/ {lanes=1; color=8; display_level=256; label_level=16; font_size=1; next}
> /^TYPE=service/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=service; residential/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=steps/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=tertiary/ {lanes=1; color=8; display_level=256; label_level=32; font_size=1; next}
> /^TYPE=tertiary_link/ {lanes=1; color=8; display_level=256; label_level=32; font_size=1; next}
> /^TYPE=t/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=track/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=trail/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=tr/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=trunk/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=trunk_link/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=unclassified/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> /^TYPE=unsurfaced/ {lanes=1; color=4; display_level=64; label_level=16; font_size=1; next}
> 
> # key: set the search key to be the Tiger/Line ID.  Not currently
> # used.
> #/^TLID=(.*)$/ {key=$1; next}
> 
> # just a demo of the END_RECORD and END rules:
> #END_RECORD {name="$name ($key)";}
> #END {}
> ---------------------------------------------------------------------
> 
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://lists.xastir.org/cgi-bin/mailman/listinfo/xastir




More information about the Xastir mailing list