[Xastir] New capability: 2008 Tiger Shapefile street maps
Gerry Creager
gerry.creager at tamu.edu
Sun Apr 19 09:52:01 EDT 2009
Lee Bengston wrote:
> On 4/18/09, Curt, WE7U <archer at eskimo.com> wrote:
>> On Fri, 17 Apr 2009, Curt, WE7U wrote:
>>
>> Use the "vi" editor to change the map layers:
>>
>> vi ~/.xastir/config/map_index.sys
>> :g/tabblock/s/01000/00995/
>> :g/pointlm/s/01000/00996/
>> :g/arealm/s/01000/00997/
>> :wq
>>
>> (Who's a "sed" user? Give us some commands to do the same thing in
>> sed please! Commands should be similar but can then be scripted.)
>>
>> Start up Xastir and select the maps. I've been selecting only these
>> types of maps:
>>
>> arealm.shp
>> areawater.shp
>> edges.shp
>> tabblock.shp
>
>> As I mentioned: Perhaps we can automated the process of
>> downloading/installing these maps and setting the map levels for
>> them.
>>
>
> I never did warm up to vi. I put the following in a perl script
> inside the ~/.xastir/config directory:
Warming isn't the problem. One should always be comfortable in vi for
those scarey times when neither ed nor edlin are available.
gerry
> #!/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);
>
> $indexfile = "map_index.sys";
> $layer1 = "00997";
> $layer2 = "00996";
> $layer3 = "00995";
>
> # 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);
> }
> 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";
>
>
> Regards,
>
> Lee - K5DAT
> Murphy, TX
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://lists.xastir.org/cgi-bin/mailman/listinfo/xastir
--
Gerry Creager -- gerry.creager at tamu.edu
Texas Mesonet -- AATLT, Texas A&M University
Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.862.3983
Office: 1700 Research Parkway Ste 160, TAMU, College Station, TX 77843
More information about the Xastir
mailing list