[Xastir] dbfawk questions

Tom Russo russo at bogodyn.org
Thu Dec 30 14:37:04 EST 2004


On Thu, Dec 30, 2004 at 11:16:10AM -0600, we recorded a bogon-computron collision of the <jdw at eng.uah.edu> flavor, containing:
> I'd like to make certain lines display differently depending on the 
> display level.  When displaying state outlines, for example, I'd like 
> to see a wide dotted gray line when close in (zoom level <= 1024), but 
> display as a narrow solid black line when farther out.  Can a dbfawk do 
> this and if so, how?

No, dbfawk is too simple at this point.  To do what you want would require
that the parser be a lot beefier than it is.  Right now it does a pattern
match on the regexp enclosed by "/" with PCRE, and if there's a match
it peforms the simple assignments inside the braces.  I'm not even sure you
can do arithmetic inside there.

One could beef up that parser and make it do more complex stuff (having 
conditionals would be good, and allowing settings to be zoom-level dependent
would be cool).  Nobody's done it yet, though. 

> Can a dbfawk be used to stop the processing and display of a shapefile? 
>  e.g.,  if the current zoom level is >1024, I don't want to display any 
> TIGER shapefiles.  I know I can do this with map properties, I just 
> wondered if dbfawk could, too.

No, you have to use both the dbfawk file and a map property.  This is 
painful to set up the way the map properties dialog works, but less so now
that it doesn't clear selection every time.

> Can I do a mathematical relation test instead of a regular expression?  
> e.g., something like
> 
> /POPULATION<10000/ {display_level=256}

No, the thing in the slashes has to be a perl-type regular expression.  When 
dbfawk grabs the record, it creates a string "POPULATION=<value>" and you match
against that.  It doesn't create a variable called POPULATION that you can
do relational tests against.  You could, however, use regular expressions
to check that the string following the equals sign was fewer than 5 digits:
  /POPULATION=\d{1,4}/
to select populations of 1 to four digits
  /POPULATION=\d{5,}
to select populations greater than 5 digits
  /POPULATION=([5-9]\d{4}|\d{6,})/
to select populations greater than 50000 (i.e 5 digits with 5-9 as first digit,
or six or more digits), etc.

> I've been writing a dbfawk for the National Atlas "cities" shapefile, 
> and found out that some very large cities like Nashville, TN and some 
> very small places like Smoke Rise, AL are both in the same population 
> range - "Undetermined".  Arrggghhhh!

Nod.  I've been messing with the national atlas "roads" shapefile this week.
There are some annoying things about how they structured that one, but I've
got a usable (barely) dbfawk file for it on http://www.swcp.com/~russo/shape_web
as of yesterday.  I find it a useful alternative to tiger data at high zoom
levels --- use that road file at really high zooms, only bother with TIGER
when you're in tight.  Makes for much faster map draws.

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "When life gives you lemons, find someone with a paper cut."



More information about the Xastir mailing list