Using TIGER maps with JavAPRS


This document describes one way to use the US Census Bureau's online TIGER map service with Steve Dimse's JavAPRS.  Examples can be found at http://radio.artsfac.csuohio.edu.

Introduction

Steve Dimse, K4HG, has written a great companion to the APRS internet backbone, an online real-time viewer called JavAPRS.  This application allows anyone with a java-capable web browser to view APRS activity live, as it happens.  Being used to using WinAPRS with Precision Maps at home, I had been disappointed with the quality of the (dos style) maps available for use with it.  In reading the JavAPRS documentation, I found that it also supports dynamic street-level maps retrieved from the Census Bureau's TIGER map server -- but that the security built in to JAVA prevented the use of the map server directly in most configurations.  Basically, a JAVA application can only make network connections to the server it was originally loaded from.   Steve mentioned an application called the "LIDS Windows TNC Server" that was supposed to work around this limitation -- but I was unable to find the software at the URL he supplied or anyplace else, so I decided to try to figure out a way to do this myself.
 

The Server

This solution is based on my general configuration, namely a single Linux server already running a web server, JavAPRS,  and Dale Heatherington, WA4DSY's APRSd for linux.  This is important because as mentioned above, JAVA requires all data to come from a single server.  I assume that you've already got Apache (or some other web server), JavAPRS, and APRSd running correctly.

The only additional software required on the linux server is freely available on the net.  There are probably several different variations on the idea available, but I used "redir" by Sam Creasey. (Also available here) Basically, this software accepts a TCP connection on a specified port and forwards that connection to another specified port on another server.  This is the basic idea required to make TIGER maps work -- since JavAPRS can only contact your server, you have to make a port on your server look like the TIGER server.

To make this automatic on my Redhat linux system, I simply added a script to start "redir" in daemon mode, so it sits around waiting for incoming requests and forwards them.  The script is available here.  Put it in /etc/rc.d/init.d and create a symlink in /etc/rc.d/rc3.d to start the server automatically on boot.

I'll quickly review the command line options that  I use with when starting redir to aid in understanding what's going on.  The command I use is:

/usr/local/bin/redir --lport=14500 --cport=80 --caddr=cyan.census.gov --syslog &

The --lport option specifies the local port to listen on.  14500 is the port number suggested in Steve Disme's JavAPRS documentation, so that's what I use here.  Technically any unused port could be used, but the port number needs to be known when configuring JavAPRS on the web page.

The --cport option specifies the port to connect to.  In this case, we use port 80, the web server's port on the TIGER map server.

The --caddr option specifies the IP address or hostname of the server to connect to.  Special note should be taken of this!  The "normal" server for tiger maps is tiger.census.gov.  I found in testing though that a request sent to this server actually returns a "redirect" to the cyan.census.gov server.  If you use tiger.census.gov directly, when JavAPRS requests a map, it'll get a response basically saying "contact cyan.census.gov for this information".  As stated previously, though, JavAPRS cannot contact that host directly, so the map retrieval still fails -- so I go straight to the source the first time.  The Census Bureau web pages indicate that funding for the TIGER map server is minimal and there are no immediately planned upgrades or changes -- but that is always subject to change, so the cyan.census.gov address may become invalid at some time in the future.

The --syslog option tells redir to log its activity using syslog.  It uses the "deamon" facility, so you have some control over where the data is logged by editing /etc/syslog.conf.

Finally, the & at the end of the line puts the program in the background.

Once the "redir" program is installed and started per these directions, all incoming connections to port 14500 will be redirected to the census bureau and you should be ready to configure JavAPRS to use TIGER maps.
 

The Web Page

JavAPRS is accessed though a web browser and served from a Web Server.  It is started and configured by use of special tags in the HTML file of the web page it's accessed from.  Here's the pertinent HTML from my web page that starts and configures JavAPRS:

<APPLET codebase = "javAPRS/" CODE="javAPRS.class" WIDTH=600 HEIGHT =500>
<PARAM name = "tigerMapLeft" value = "81.9633">
<PARAM name = "tigerMapTop" value = "41.6439">
<PARAM name = "tigerMapHigh" value = ".3989">
<PARAM name = "tigerMapRelay" value = "radio.artsfac.csuohio.edu:14500">
<PARAM name = "dataFile1" value = "net:radio.artsfac.csuohio.edu">
<PARAM name = "stationlist" value = "true">
<PARAM name = "echoDataConsole" value = "true">
<PARAM name = "trackstations" value = "true">
<PARAM name = "showMapLabels" value = "true">
<PARAM name = "drawvectors" value = "true">
<PARAM name = "homeID" value = "N8LXY-10">

All these commands are well documented in the JavAPRS documentation.  The important lines with regards to using TIGER maps are:

<PARAM name = "tigerMapLeft" value = "81.9633">
<PARAM name = "tigerMapTop" value = "41.6439">
<PARAM name = "tigerMapHigh" value = ".3989">
<PARAM name = "tigerMapRelay" value = "radio.artsfac.csuohio.edu:14500">

These set the Lat/Long of the upper left-hand corner of the default map and the default height of the map in degrees.  The last line is the most important -- it should be edited to use your server name in place of "radio.artsfac.csuohio.edu" and the port number you chose to use when starting "redir".  This line tells JavAPRS that it can actually get the TIGER maps from your server instead of the Census Bureau's.

That should be it!  If everything worked right, when you load your JavAPRS page you should get a map retrieved from the TIGER service, and each time you pan or zoom the map, a new map should be requested and displayed.
 

Caveats


Some Caveats should be noted when using these instructions.  First, a nasty person could make repeated connections to your server on port 14500, which would causes repeated connections to the census bureau's web server originating from your server -- so basically someone can make it look to the census bureau like you're using a denial of service attack on them when it's actually someone attacking you.  This is a risk that you take providing a public service I guess.  Second, Steve Dimse describes a display problem relating to TIGER using a different map projection method than JavAPRS here.  Basically it can cause incorrect icon placement that's most noticeable the larger the area of your map.
 

Disclaimer


As is usual in this day and age, I need to remind everyone that while this system works for me, I can't guarantee that it'll work for you or that it won't cause you problems.  I'm not aware of any problems except for the possible DOS attack I described above, but I'm no expert. Use caution and common sense.

Greg Romaniak, N8XOS can be connected at [email protected].