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)
Contents
- 1 BUILDRPMS
- 2 Coordinate.pm
- 3 LSB-BUILD*
- 4 STABLE
- 5 UIView2XastirLog.pl
- 6 Xastir_tigerpoly.py
- 7 ads-b.pl
- 8 ais.pl
- 9 coord-convert.pl
- 10 do_xastir_release_dev
- 11 do_xastir_release_stable
- 12 example_objects.log
- 13 geopdf2gtiff.pl
- 14 get-BOMdata
- 15 get-fcc-rac.pl
- 16 get-NWSdata
- 17 get-gnis
- 18 get-pop
- 19 gpx2shape
- 20 icontable.pl
- 21 inf2geo.pl
- 22 kiss-off.pl
- 23 mapblast2geo.pl
- 24 mapfgd.pl
- 25 object2shp.pl
- 26 overlay.pl
- 27 ozi2geo.pl
- 28 permutations.pl
- 29 pos2shp.pl
- 30 ridge_radar.pl
- 31 slideshow.pl
- 32 split_gnis.bash
- 33 split_gnis.pl
- 34 test_coord.pl
- 35 toporama250k.pl
- 36 toporama50k.pl
- 37 track-get.pl
- 38 update_langfile.pl
- 39 waypoint-get.pl
- 40 xastir-fixcfg.sh
- 41 xastir-migrate.sh
BUILDRPMS
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
Coordinate.pm: Perl module for:
- 1) Creating and manipulating Coordinate objects,
- 2) Translating coordinates between UTM and Latitude/Longitude,
- 3) Translating coordinates between ~231 different datums,
- 4) Formatting coordinates into decimal degrees, degrees/minutes, and degrees/minutes/seconds.
LSB-BUILD*
Developer scripts. Used to build various pieces used by Xastir to create an Xastir LSB version.
STABLE
Script used by developers, not intended to be used by the general userbase.
UIView2XastirLog.pl
Script to convert a UI-View log file to an Xastir log file.
Xastir_tigerpoly.py
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.
ads-b.pl
This script, along with an RTL SDR USB dongle and a certain fork of the "dump1090" (and optionally another RTL dongle and the "dump978" code), will allow Xastir to display ADS-B OUT positions of aircraft in real-time. See the comments at the top of the script for usage information.
ais.pl
This script, along with an RTL SDR USB dongle and "rtl-ais" (and optionally another RTL dongle to receive the long-range frequencies), will allow Xastir to display AIS positions of ships in real-time. See the comments at the top of the script for usage information.
coord-convert.pl
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:
- http://www.impulse.net/~mlynch/land_nav.html
- http://www.logicsouth.com/~lcoble/dir9/land_nav.htm
- http://www.aasar.org/training/academy/navigation.pdf
do_xastir_release_dev
Another "developer script" not intended for general consumption. Since the Xastir project no longer uses sourceforge for version control or release management, it is in dire need of reworking, as releases are handled by Github in a very different way.
Release a new version of Xastir by downloading, configuring, and compiling the latest Git version, then creating the tarball. Upload it via anonymous FTP to "upload.sourceforge.net/incoming" and then finish the release process on SourceForge:
- Admin
- Edit/Add File Releases
- Edit Releases (xastir-development)
- Edit This Release (xastir-1.8.3)
do_xastir_release_stable
Same as above, but for stable release.
example_objects.log
Examples of Area Objects that Xastir can create. Bringing in this log file should result in images like the following: and .
geopdf2gtiff.pl
Script to convert a GeoPDF file with included neatline into a collar-stripped geotiff in EPSG:4326 projection (WGS84 equidistant cylindrical) in 8-bit color.
get-BOMdata
Script to retrieve BOM data files (Australian weather data files).
get-fcc-rac.pl
Gets FCC (U.S.) and RAC (Canada) databases of amateur radio operators and places them into appropriate directory for use by Xastir. Must be run as "root".
(file needs comments added)
get-NWSdata
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
get-gnis
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/.
get-pop
Script to retrieve GNIS files by state.
gpx2shape
(No Comments in file)
Converts gpx format to shapefiles. See README.MAPS under "National Geographic Topo" section.
icontable.pl
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
inf2geo.pl
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.
kiss-off.pl
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
mapblast2geo.pl
XASTIR .geo file generator for mapblast pixel maps 16.10.2001 Copyright (C) 2001 Rolf Bleher http://www.dk7in.de
mapfgd.pl
Creates fake fgd files for all correctly USGS-named maps which don't already have them
Usage:
mapfgd <directory>
object2shp.pl
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.
overlay.pl
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.
ozi2geo.pl
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
permutations.pl
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.
pos2shp.pl
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.
- ./pos2shp.pl test.pos testmap
- cp testmap* /usr/local/share/xastir/maps/.
Xastir:
- Map->Configure->Index: Add New Maps
- Map Chooser: Select the "testmap" map
ridge_radar.pl
This script takes a single argument: The abbreviation of the radar station off of the NWS site, and outputs to STDOUT a .geo file that should be correct. NOTE: You'll need to install "LWP::UserAgent" and "Image::Size" from CPAN to make it work.
Here's a typical invocation which creates a NYC Ridge Radar .geo file called OKX_NOR.geo:
./ridge_radar.pl OKX > OKX_NOR.geo
Of course you'd typically put the resulting file in your Xastir maps directory and reindex maps to make it available for use.
slideshow.pl
Script to create a slideshow from Xastir snapshot images. Note that this script is Unix/Linux-centric due to the use of the $HOME variable and the use of the "cp" command.
split_gnis.bash
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 at arrl.net
split_gnis.pl
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 at arrl.net.
The filenames used as input should be put on the command line.
2004 Mar 15 -- jmt at twilley.org
test_coord.pl
Perl code to test out the Coordinate.pm module.
toporama250k.pl
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
toporama50k.pl
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.
track-get.pl
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_langfile.pl
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
waypoint-get.pl
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/
xastir-fixcfg.sh
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!
xastir-migrate.sh
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)?