If you have a computer that can run Java and a GPS then this chart plotter program can show a map with a mark at your position.
It should work with all NMEA compatible GPS receivers that sends the GPGLL sentence.
The maps can be in JPEG format.
Translation between position and map co-ordinates is done with the help of 2-4 reference points that are read from a chart data file.
Java 1.1
Preferably with the Java Communications API.
If you have only 16MByte of memory loading image files will be very slow.
Here is the program including source code:
ChartPlotter.zip
If you have no Java installed we recommend SUN's JDK.
It can be downloaded from Sun’s www site:
java.sun.com/products/OV_jdkProduct.html
The Java Communications API is found here:
java.sun.com/products/javacomm/index.html
Install Java and the Java Communications API according to their respective instructions. On NT and Linux it is possible to run the ChartPlotter without the Communications API but then you will have to set baud rate yourself each time you start it.
Add the ChartPlotter.zip file to your CLASSPATH environment variable.
If you use Windows you can put something like this in your autoexec.bat file:
set CLASSPATH=.;c:\java\ChartPlotter.zip;
Or perhaps if you have a CLASSPATH variable already
(which you do if you have installed the API):
set CLASSPATH=%CLASSPATH%;c:\java\ChartPlotter.zip;
In the examples above the zip file with the ChartPlotter code was stored in the folder "c:\java". Reboot or something.
You will also need maps. You can use a scanner and scan your own maps and then supply the program with 4 reference points per map so that it can translate GPS positions to pixels on the map.
There is a program called CalibrateChart
to be used for creating the data files with chart reference points.
Do cd to where the image files are and try:
java CalibrateChart
The CalibrateChart program can not create the top file used to do include on the other data files.
The reference point data is stored in ascii text files. The format shall be like in these example charts.dat files:
First a top file preferably called charts.dat that tells ChartPlotter which files it shall read.
------------cut here------------
// charts.dat
include chart1.dat
include chart2.dat
------------cut here------------
Then one data file for each image (usually .gif or .jpg) file. These files can be created with the CalibrateChart program or written manually.
------------cut here------------
// chart1.dat
begin ChartData
name chart1.jpg
ref 342 71 59N20.0 018E04.0
ref 1239 948 59N18.0 018E08.0
ref 350 950 59N18.0 018E04.0
ref 1240 70 59N20.0 018E08.0
lim 59N18 59N20 18E04 18E08
datum WGS-84
rem "Stockholm chart from 1998"
end
------------cut here------------
------------cut here------------
// chart1.dat
//
begin ChartData
name chart2.jpg
ref 312 61 59N20.0 018E08.0
ref 1219 958 59N18.0 018E12.0
datum RT
comp 0.02 0.21
end
------------cut here------------
See also this example chart and charts.dat file:
charts.zip
Lines beginning with "//" are ignored.
Reference points. First in a reference point is the XY co-ordinates <x> and <y> in the image file. Then the corresponding latitude <lat> and longitude <lng> on the map.
Three reference points give get better precision than two. The first three reference points must not be placed near each other. Place them so they form a triangle. The forth point is used to verify the other three. Later when the program is running you will see a number after the map name. This number tells how far away the forth reference point is from a position calculated using the first three.
We recommend that you put your GPS in simulator mode and test the calibration on each map by going to some random positions.
The area covered by the chart is given with south, north, west and east borders. Set the chart coverage a little smaller than the actual size so that the program will try to find another chart before reaching the edge.
The program will show the first chart in the list that fits. We recommend some overview maps last in the chart data file.
<south-lat> is the south border of the map and so on.
A free text message <t> to be shown in the title when this chart is used.
To start the program you can use a shortcut or you can start from the command line in a command tool such as MS-DOS prompt if you use windows.
Usage: java ChartPlotter [switches] [<file name>]
<file name>
The name of the file with reference points (charts.dat is default).
switches:
-p<n>
The name of the com port to use is <n>
(On Windows COM1 is default).
-h
List more switches.
In Windows it is convinient to have a shortcut.
Left-click on desktop
Choose new -> shortcut.
In command line type "javaw ChartPlotter"
Click next.
Choose the name "ChartPlotter"
Left-click on the new shortcut and choose properties.
In the field "start in" replace "C:\PROGRAM\JDK1.1.6\BIN" with the folder where you have your charts
for example "c:\charts".
Chose change icon and select one that looks nice. Perhaps one with a globe.
The GPS receiver needs to have an NMEA compatible serial port interface.
NMEA is a one way protocol so the PC can not tell the GPS to start sending NMEA.
Check your GPS receiver’s documentation on how to start sending data in NMEA
format from your GPS.
Check if correct java is installed? If you use JDK (or JRE) you need 1.1.8 or later.
In a command window type:
java -version
It should say something like:
java version "1.1.8"
If you don't have the Java Communications API installed the program will try to use the serial ports without it. On Windows this will probably not Work.
If you see the ChartPlotter program write the following lines then the Java Communications API is not installed.
------------cut here------------
Windows COM1
Remember to set baudrate before starting this program.
It is done like this:
MODE.COM COM1 4800,N,8,1
If it still don't work try to install the Java Communications API.
loading data
------------cut here------------
Java will use the environment variable CLASSPATH to find the java classes.
If java say:
Can't find class ChartPlotter
Then check the CLASSPATH variable like this (windows):
echo %CLASSPATH%
You should get something like this:
.;c:\java\CharPlotter.zip;c:\Program\jdk\bin\comm.jar
Note the paths in the line above can be different depending on installation.
Now check if the files above exist (use the path you got above not the one shown here):
dir c:\java\CharPlotter.zip
dir c:\Program\jdk\bin\comm.jar
If it don't work use a terminal emulator (such as HyperTerminal in Windows) to see if the GPS is sending anything. If it is check if it sends lines beginning with "$GPGLL" etc and if there is position data in that line. Set the com port to 4800 baud, 8 data, 1 stop, no parity. If its sends nothing check the documentation for your GPS on how to make it send NMEA.
If a file is not found the program prints something like the following
line:
ChartThread: java.io.FileNotFoundException: charts.dat
You need to be in the same folder as the charts.dat when you start the program.
If not try cd to that folder.
If an image file (usually a .jpg file) is missing you might get just a blank window.
It probably won't work to have reference points on both sides of the datum line. A workaround is to use two sets of reference points for the same chart image file.
On Windows 95 and 98 it only works if you have the communications API installed.
On NT and Linux the ChartPlotter program can work also without the Java communications API but it can't set baud rate without the API so you will have to set the baudrate manually before starting the ChartPlotter. (4800 baud, 8 data, 1 stop, no parity).
Counting line numbers in data files do not work correctly anymore. (The line numbers are only used to tell where a syntax error in a charts.dat file is located if such an error is found.)
Here is our list of GPS related sites.
GpsLinks.html
If you like this software please let us know. Send comments or
questions to:
Put the word ChartPlotter in the subject line. Otherwise my anti spam email filter will probably throw your email away.
Copyright 1998 and 1999 Henrik Björkman www.stacken.kth.se/~bjorkman. Version 0.15 of this software may be distributed as under the GNU public license.
You may not use this software as your only means of navigation. In no way shall the creators of this software be responsible for any damage caused directly or indirectly by the use of this software.
You use this software completely at your own risk.