[Xastir] dbfawk and tiled shape files

Tom Russo russo at bogodyn.org
Thu Apr 26 16:31:30 EDT 2007


On Thu, Apr 26, 2007 at 12:39:34PM -0700, we recorded a bogon-computron collision of the <archer at eskimo.com> flavor, containing:
> On Thu, 26 Apr 2007, Mike Fenske wrote:
> 
> >  You can get by with one dbfawk file if the dbf fields are the
> >  same for each shapefile and you want each shapefile displayed the
> >  same. Sounds like this is what you want. I have done just that
> >  here with a large shapefile I split up. Put the dbfawk file in
> >  the /usr/local/share/xastir/config directory. The name of the
> >  file doesn't really matter. Name it something so you can remember
> >  what shapefile set it's for. The important thing is that the
> >  "dbffields" list matches the dbf fields of the shapefile set.
> >
> > I'm not sure, but I think you have to either restart Xastir or
> > maybe "re-index all maps" to get it to recognize the new dbfawk
> > file. Tom or Curt will know for sure :)
> 
> As I recall, the rules are:
> 
> *) If it is in the directory listed above, you have to restart
>    Xastir to reload that file.
> 
> *) If it's a per-map dbfawk that's located with the map file itself,
>    loading the map reloads the dbfawk.

Close.  It's actually like this:

 1) First we look for a per-map file that has the same base name as the map,
    and a ".dbfawk" suffix.  If found, it's used.

 2) If no per-map file is found, a per-signature file is searched for in
    the config directory.


The the signature-based files are parsed on first map draw and saved, and once 
upon a time it required a restart of xastir to re-parse them.  I changed that 
quite some time ago -- now the dbfawk signatures are purged upon re-indexing
maps, either by selecting "Reindex ALL maps" or "add new maps".  It is not
necessary to restart anymore, and it isn't necessary to reindex all maps either.
"Add New Maps" will force a reload even if there are no new maps.  I set that
up deliberately so that when folks are working on per-signature dbfawk files
they don't have to sit through entire program restarts or full map reindexes
to check their slightly modified dbfawk files.

NOW... there's another issue.  The original poster was clearly trying to 
tinker with dbfawk files pertaining to weather alert counties; he's cut them
up into smaller tiles and wants to tinker with the rendering.  For the 
wx county shapefiles, there's already a per-signature dbfawk file in the config
directory, so one does NOT have the option of creating a second, distinct
signature-based dbfawk file to render a new set differently, unless one 
modifies the list of attributes in the shapefile (i.e. redoes the dbf file).  
The per-signature files in the config directory are set up for dealing with 
weather alerts, and if you want your tiled files to be used for something else 
with different rendering, you have no choice other than to use per-file dbfawk 
files, or hack the .dbf files so they have different signatures.

I use the county files for two purposes myself, for regular weather alert 
display, and as a vector overlay to see the counties all the time.  To do this
requires two different sets of rendering rules, so my approach to getting
around the limitation is to have a separate directory in the maps folder with 
symlinks to the county files in the /usr/local/share/xastir/Counties directory,
but with different names:

ls -l /usr/local/share/xastir/maps/counties/c.???
lrwxr-x---  1 tvrusso  tvrusso    51 Nov  7  2005 c.dbf -> /usr/local/share/xastir/Counties/c_08au05.dbf
lrwxr-x---  1 tvrusso  tvrusso    51 Nov  7  2005 c.shp -> /usr/local/share/xastir/Counties/c_08au05.shp
lrwxr-x---  1 tvrusso  tvrusso    51 Nov  7  2005 c.shx -> /usr/local/share/xastir/Counties/c_08au05.shx

and a per-file dbfawk file with different rendering rules than the default
rules for wx alerts:
-rw-r-----  1 tvrusso  tvrusso  2598 Aug  7  2006 c.dbfawk

So without tinkering with the .dbf file, the only option would be something
similar.  So if you have files c1.shp, c2.shp, c3.shp, you could have a c.dbfawk
with special rendering, then symlink c1.dbfawk, c2.dbfawk, and c3.dbfawk to
that single file.

Once you tinker with the dbf file to change its signature to something unique,
however, you could make a new signature-based file and just stuff it into
the config directory instead.  I am not aware of a simple tool that can 
do this dbf modification easily --- you might have to tinker with the 
shapefile splitting tools (I think you might be talking about the ones on my
http://www.swcp.com/~russo/shape_web/ site, which are very simple and could
be hacked for this purpose).

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://kevan.org/brain.cgi?DDTNM
"And, isn't sanity really just a one-trick pony anyway? I mean all you get is
 one trick, rational thinking, but when you're good and crazy, oooh, oooh,
 oooh, the sky is the limit!"  --- The Tick



More information about the Xastir mailing list