[Xastir] New capability: 2008 Tiger Shapefile street maps (Dale Seaburg)

Lee Bengston lee.bengston at gmail.com
Mon Apr 20 01:57:10 EDT 2009


On 4/19/09, Dale Seaburg <kg5lt at verizon.net> wrote:

> I added one more line to the 3-line layer adjustment technique.  It
> allows the cousub,dbfawk and cousub00.dbfawk files to place the town/
> city names (census docs refer to the name as a subdivision name)
> within a county over all other features.  I was experiencing the
> names being overlaid by roads (in particular) when the name and road/
> feature crossed.  Here it is:
>
> -e "/cousub/s/01000/01001/g"

I modified the perl script to adjust the layer for the cousub and
cousub00 map files in addition to the others.
Here are a few instructions for those who would like to try it out:

1) Copy the text between the ++++++ lines below to a text
file named update-index.pl (or whatever name ending in .pl
that you desire), and put it in your /home/username/.xastir/config
directory.

2) Make sure your 2008 shapefile maps have been
extracted and copied into your choice of directory(s)
under /usr/local/share/xastir/maps.

3) Launch Xastir, re-index the maps, and choose the
2008 maps that you want to display.  The maps should
display, but many areas will be lacking roads, etc.

4) Exit out of Xastir.

5) Open up a terminal inside /home/username/.xastir/config
and enter the command as follows:
  perl update-index.pl

5) Restart Xastir - the maps should now show the missing roads, etc.

++++++++++++++++++++++++++++++++++++++

#!/usr/bin/perl

# backup the map index file

`cp ~/.xastir/config/map_index.sys ~/.xastir/config/map_index.sav`;

# Define variables

my ($indexfile, $checkline, $layer1, $layer2, $layer3, $layer4);

$indexfile = "map_index.sys";
$layer1 = "00997";
$layer2 = "00996";
$layer3 = "00995";
$layer4 = "01001";

# Enable PERL simple debug
use strict;
use warnings;

#open the config file
open(INDX, $indexfile) || die("Cannot Open File");

#open a temp output file
open(TMP, ">temp.sys");

# read lines in, fine/replace text, and write to the temp file
while(<INDX>)
 {
  $checkline = $_;
  if (rindex($checkline, "arealm") > 0)
    {
      substr($checkline,44,5,$layer1);
    }
  elsif (rindex($checkline, "pointlm") > 0)
    {
      substr($checkline,44,5,$layer2);
    }
  elsif (rindex($checkline, "tabblock") > 0)
    {
     substr ($checkline,44,5,$layer3);
    }
elsif (rindex($checkline, "cousub") > 0)
    {
     substr ($checkline,44,5,$layer4);
    }
  print TMP $checkline;
 }
close(INDX);
close(TMP);

# copy the temporary file to the map index - thus overwriting
# it with the updated version
`cp ~/.xastir/config/temp.sys ~/.xastir/config/map_index.sys`;

# Delete the temp file
unlink "temp.sys";
+++++++++++++++++++++++++++++++++++++

I have found that as I keep adding maps, I have to keep updating the
index file, and it's nice to be able to do it with one command.

Lee - K5DAT
Murphy, TX



More information about the Xastir mailing list