The Xastir scripts directory contains a number of helpful scripts. This page is a collection of notes, mostly culled from the comments in the scripts themselves, intended to document the functionality provided by each of the scripts.
--N8ysz 07:51, 22 September 2006 (EDT)
This is an example script used by one of the developers to ease the workload. It's not intended to be used by the general userbase. It's included with the Xastir sources so that it doesn't get lost if the developer should suddenly drop out of sight.
Coordinate.pm: Perl module for:
Modified version of GDAL/OGR "tigerpoly.py" script (as described below) adapted to assemble information from more tables of the TIGER/Line data than had been done by the original, and with the option of dissolving common boundaries between areas with identical landmark values.
You must have installed GDAL/OGR, configured to use python in order to use this script
Adapted for Xastir use by Tom Russo
NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
When run with the "-d" option, this script changes the topology of TIGER/Line polygons by dissolving common bounaries between adjacent polygons with identical Landmark values. This is done SOLELY for improvement of on-screen presentation of the shapefiles, and the resulting files have too much information removed to make them useful for any other purpose but display in Xastir.
If any shapefile data produced by this script with the -d option are distributed publicly, they should have a prominent disclaimer to this effect. The data produced by this script with that option bear only a superficial, graphical resemblence to the TIGER/Line data from which they were created.
Converts between different lat/lon formats. Will also give UMS position if the lat/lon resides somewhere inside the Seattle area aeronautical map.
UMS coordinates have been used in the past by King County, WA SAR. It can be useful for plotting positions on Green Trails maps and perhaps other maps. The maps must be 15' topo maps and marked in tenths of miles along the edge in order to make use of this coordinate system.
Web pages which discuss UMS format:
Another "developer script" not intended for general consumption
Release a new version of Xastir by downloading, configuring, and compiling the latest CVS version, then creating the tarball. Upload it via anonymous FTP to "upload.sourceforge.net/incoming" and then finish the release process on SourceForge:
Same as above, but for stable release.
Examples of Area Objects that Xastir can create. Bringing in this log file should result in images like the following:
and File:Area Objects2.png.
Gets FCC database of US amateur radio operators and places it into appropriate directory for use by Xastir.
(file needs comments added)
Script to retrieve NWS data files.
Originally written 2006/03/07 by Steven, WM5Z, and Curt, WE7U.
See README.MAPS for a bit more information on the program
NOTE: Run this script as root. See Notes:Sudo
Script to retrieve GNIS files by state.
Written 20041205 Dan Brown N8YSZ
Usage:
get-gnis ST [ST]...
Substituting 2 letter state codes for ST. Needs at least one state to download. Places gnis files in appropriate directory, defaults to /usr/local/share/xastir/GNIS/.
Retrieves and compiles various maptools libraries and add-ons, in the correct order, including: pcre, shapelib, proj, gdal, and libgeotiff.
Based on get-shapelib.sh. This script may not work on all OS's, but should work on Linux, Cygwin, Solaris, etc.
Hacked together by Dan Brown, N8YSZ.
Script to retrieve and install Shapelib. Probably superceded by get-maptools.sh.
(No Comments in file)
Converts gpx format to shapefiles. See README.MAPS under "National Geographic Topo" section.
This script produces an overview graphics with all symbols used by Xastir.
Output is as a XPM file to STDOUT
typical call: icontable.pl > symbols.xpm
Invoke this script against one or more info files by typing:
inf2geo.pl filename.inf
or
inf2geo.pl *.inf
To process all .inf files in that directory.
Read in .inf file (from Ui-View)
Convert the lat/long coordinates into dd.dddd format
Get the image extents via "identify -ping filename"
Write out the .geo file
Note that this program assumes (and converts to)
lower-case for the filename.
Note: It appears that .INF files store the lat/lon in DD.MM.MMMM format. Converting the script to this format.
This script will send the proper characters to STDOUT to command a KISS TNC out of KISS mode. Redirect it to the port that the TNC is connected to. Turn off the port in Xastir first.
It is assumed that the baud rate on the port and the baud rate of the TNC match, if not, this won't work. If you've just been using the TNC in Xastir, they probably match.
Use the script like this:
./kiss-off.pl >/dev/ttyS1
XASTIR .geo file generator for mapblast pixel maps 16.10.2001 Copyright (C) 2001 Rolf Bleher http://www.dk7in.de
Creates fake fgd files for all correctly USGS-named maps which don't already have them
Usage:
mapfgd <directory>
This script produces an [ESRI] point [shapefile] from the object.log file, according to the "Rolling your own shapefile maps" section of README.MAPS. The point file will display using the TIGER Landmark Point dbfawk file.
This enables fast generation of point maps by using xastir to plop down objects, then this script to turn the object.log file into a shapefile.
Typical usage:
object2shp.pl object.log myshape
Remember to exit xastir and delete "object.log", otherwise xastir will never forget your objects.
Script to create Xastir "Overlay" files from "CSV" files of the proper format (comma-delimited files).
1) Creates files in Xastir "log" format if you enter a callsign below. These files can then be put in your ~/.xastir/logs/ directory and brought in via the File->Open Log File menu option. If you start with the CSV files in the ~/.xastir/logs/ directory and process them there with this script, the output files will be placed into the proper place for Xastir to find them.
2) If no callsign is entered, this script will create files in Xastir's "~/.xastir/config/object.log" format. You can then replace or append the file to the object.log file, restart Xastir or "Reload Object/Item History".
Note: These APRS Items will become part of your locally owned/transmitted objects, so if you don't want them transmitted, turn of Object/Item transmit before bringing them in.
Input: Directory name. If no directory name passed in, it will operate on every CSV file in the current directory.
Input format: Name N/S lat E/W long // comment fields............. SUPPLY,N,34.0000,W,78.0000,ICON,text1,text2,text3,text4,...
The name will have spaces removed if it is longer than nine
characters. If it is still too long, vowels will be removed, then it will be truncated to nine characters if still needed. The full name will be transmitted as a comment. All other text fields will also be transmitted as comments, so that they will all appear in the Station Info dialog.
Icons will be a default small red circle unless '/' or '\' is the leading character in that field and the next specifies the APRS symbol. In that case the two-letter combination will get used as the symbol for the Item.
Change this to match whatever callsign you're running Xastir as, so that the APRS Items appear to have been generated locally. You can then suck this file in as a "log" file from within Xastir. If this field is empty, then instead write the packets out without a header, as in Xastir's "object.log" format.
Read in .map file (an OziExplorer file in this case).
Check the version of the map format (1st line). My example is version 2.2.
Get the filename from the 2nd line of the file.
Check that "WGS 84" or "NAD 83" are present in the file (5th line?).
Check the "Map Projection".
Grab the first four points, which hopefully are the corners.
Snag the MMPXY lines and the MMPLL lines. These are the X/Y and Lat/Long of the corners in the example I have.
Write out the .geo file
Finds the different lat/long representations corresponding to the input numbers. A space is required between the degrees portion and the rest of the input. Writes out a log file containing APRS objects suitable for importing into Xastir, to graphically plot the locations of the objects. Now that Xastir has a server port we could directly inject them into the program via that route as well, but we currently don't do that.
Converts between different lat/lon formats. Will also give UMS position if the lat/lon resides somewhere inside the Seattle area aeronautical map.
UMS coordinates have been used in the past by King County, WA SAR. It can be useful for plotting positions on Green Trails maps and perhaps other maps. The maps must be 15' topo maps and marked in tenths of miles along the edge in order to make use of this coordinate system.
Converts APRS Overlay files (*.pos) to ESRI Shapefile maps. Use this if you have overlay files from some other APRS program and wish to use the same overlay within Xastir.
Xastir:
This will take a GNIS datapoint file (typically for a whole state, 8+Mb), break it down into smaller chunks (typically for a county, 30-200k) it will also throw away the stupid trailing spaces and <CR>'s at EOL.
This script uses the "fromdos" program. You may need to change that line to use "dos2unix" instead, depending on what utilities are available on your system.
Comments or suggestions to kc9asi@arrl.net
This script is designed to break large GNIS datapoint files into smaller chunks and will dispose of extra whitespace properly.
It is based on a bash script written by kc9asi@arrl.net.
The filenames used as input should be put on the command line.
2004 Mar 15 -- jmt@twilley.org
Perl code to test out the Coordinate.pm module.
This will retrieve the 1:250k map images from the "Department of Natural Resources Geomatics Canada" site. These are topographic map files for the whole of Canada!
cd /usr/local/share/xastir/maps Run this script from there. Make sure that you have write privileges there. Move the directories and contents to where-ever makes sense. Reindex the maps in Xastir in order to have them appear in the Map Chooser.
Note that the same map files are also available from Steve Dimse's site: "http://mm.aprs.net/maps/geo/toporama"
Code for this script contributed by Adi Linden, VA3ADI. Modifications for latitudes above 67 degrees north contributed by Tom Tessier, VE4TRT
This will retrieve the 1:50k map images from the "Department of Natural Resources Geomatics Canada" site. These are topographic map files for the whole of Canada!
cd /usr/local/share/xastir/maps Run this script from there. Make sure that you have write privileges there. Move the directories and contents to whereever makes sense. Reindex the maps in Xastir in order to have them appear in the Map Chooser.
Note that the same map files are also available from Steve Dimse's site: "http://mm.aprs.net/maps/geo/toporama"
Code for this script contributed by Adi Linden, VA3ADI.
This script will ask for an item designator, then create a file with that name + ".log" in the ~/.xastir/logs directory. The file will contain APRS items created from the downloaded Garmin tracklog. Reading that log file with Xastir will result in an object with a track being displayed on the map screen.
You may wish to bump up MAX_TRACKS in db.h to 1024 in order to see the entire log, but be careful with Xastir's memory image growing too fast if you're connected to the 'net after making this change.
This script uses the GPS::Garmin module which can be obtained from http://sourceforge.net/projects/perl-gps/
Update utility for XASTIR language files 17.04.2001
This program adds missing entries to the translated language files and deletes obsolete entries. If a translated comment before an entry block is found, it will be preserved. There might be problems with the comment with a changed block sequence.
I assume that you start it in the directory with the language files, call it with the translated language file as parameter.
DK7IN: for now it assumes that the language files reside in the current directory
This script will ask for a name, then create a file with that name + ".log" in the ~/.xastir/logs directory. The file will contain APRS items created from the downloaded Garmin waypoints. Reading that log file with Xastir will result in one item appearing on the map screen for each waypoint, labeled with the name of that waypoint.
This script uses the GPS::Garmin module which can be obtained
from http://sourceforge.net/projects/perl-gps/
fix up a user's .xastir/config/xastir.cnf to rewrite /usr/local/xastir to /usr/local/share/xastir. NOTE: This only works when -prefix=/usr/local!
migrate from old xastir USER FILES to new directory structure. Stuff that was under /usr/local/xastir is now under /usr/local/share/xastir/ fixed up the .xastir/config/xastir.cfg as well. XXX Do we throw away the xastir non-user files (config, doc, help)?