GPS extension - Track & insert points from serial gps device

From OpenJUMP Wiki
Jump to navigation Jump to search

Introduction

OpenJUMP GPS extension enables support for

  • serial gps receivers*
  • NMEA, GARMIN, SIRF protocols
  • tracking layers to current coordinate in configurable intervals
  • inserting point at current coordinate to layers
  • add current coordinate as point to existing geometry

(*) read supported receivers for more explanation

Supported GPS receivers

Serial device

GPS receivers which are connected to a physical serial port (COM,ttySxx) should work out of the box.

USB device

USB receivers connected through USB cable to the computer might also work instantly, if they utilize a serial-to-usb adapter. Check if a new serial device (COM,ttySxx) is created when connecting the device to the computer. If so this probably is your interface to the GPS receiver. Sometimes additional drivers have to be installed for this mode of operation.

Other non-serial devices

There are programs which interface GPS receivers and install virtual serial ports. If you find one for your gps device which is not mentioned here feel free to add it for others to find.

One commercial non-free alternative might be the GpsGate software. It has successfully been tested to work with Garmin eTrex Vista HCx unit on Windows Vista 32 bit.

In conclusion: GPS extension needs a serial port, either physical or virtual, delivering the GPS data. It is planned to support gpsd (over network) and file input in the future. Feel free to contact the author if the need arises on your site.

Known compatible devices

  • Haicom HI-204III with included Prolific Serial->USB adaptor Hi-204iii.JPG Hi-204iii labels.JPG, tested successfully with
    • Windows XP (x86)
    • Windows 7 (amd64)
    • Ubuntu Linux 10.4 (x86,amd64)
    • openSUSE Linux 11.3 (x86,amd64)
    • Mac OSX 10.4, 10.6

Download

Download the latest version from sourceforge.

distribution 'gps_<version>.zip'
http://sourceforge.net/projects/jump-pilot/files/OpenJUMP_plugins/GPS%2CCTS%20Extensions/
sources
contained in /lib/ext/gps.jar or in sourceforge repository
svn access
https://jump-pilot.svn.sourceforge.net/svnroot/jump-pilot/plug-ins/de.soldin.jump/trunk/

Consider downloading CTS extension (cts_<version>.zip), if you plan to work in a different reference system than your gps device outputs (usually WGS84).

Installation

Refer to Installation Steps and README.txt file in the downloaded archive for detailed installation instruction. These may change from version to version, so please read them carefully and follow them in detail.

Setup & Testing

Requirements - Make sure that
  • the extension is installed as described above.
  • the GPS device is connected.
  • the GPS device is switched on.
  • a (virtual) serial port is created. Check if software is started if you are using such.
NOTE
GPS plugin is scanning the serial ports only during OpenJUMP startup. It will not see ports which are created later.
After starting OpenJUMP you should see a new menu item 'GPS' in the main menu bar (Fig. 1).
OJ GPS 01.png
Setup settings by selecting GPS Options (Fig. 2).
OJ GPS 02.png
Settings:
Processing Format (GPS Protocol)
NMEA, Garmin or Sirf. Only NMEA tested so far.
Update every ... (Tracking interval)
Slider selects how often the plugin will center OpenJUMP map into the GPS coordinates. Scale is between 0 (disabled) to 600 seconds. e.g. 300 centers the map every 5 minutes (300 seconds) on GPS coordinate.
Notice that you cannot see your current location on the map between autotic map updates. However, OpenJUMP will refresh the GPS coordinates in the info window and current locations can be recorded at any moment.
GPS Receiver Output CS (only available when CTS Extension is installed)
This setting must suit the GPS output. The default is WGS 84 which is also supported by all GPS receivers. If GPS is configured to send out coordinates in some other systems, OpenJUMP GPS plugin needs to have definitions for that system. They are stored in the cs.conf file which is located in the lib/ext/cts directory. The format used for defining the coordinate system is OGC Well Known Text. Good source for findig the projection definitions is spatialreference.org. For example string needed to add support for UTM zone 35N projection can be found from http://spatialreference.org/ref/epsg/32635/ogcwkt/
Tracking CS (only available when CTS Extension is installed)
This setting must suit the projection that is used in the OpenJUMP project (task) or layer data loaded.
Serial Port Options
These settings setup the serial port the GPS receiver is connected to. Refer to your receivers documentation for the correct settings. For NMEA receivers they are usually as follows
  • Flow Control: none
  • Stop Bits: 1
  • Baud Rate: 4800
  • Data Bits: 8
  • Parity: None
If GPS is setup correctly then pressing the Test Settings button will show the raw output of the GPS receiver. e.g. a NMEA receiver, see Fig. 3
OJ GPS 03.png

Troubleshooting

Sometimes the extension complains that it can't find any serial ports.
Gps-no ports.JPG

In this case and in cases where the serial port your device is connected to is missing proceed as follows.

Serial device is missing aka. Found no serial ports

For troubleshooting OJ has to be started with console output enabled. To view the console start OJ with the correct script for your operating system.


Start from OJ's '/bin' folder
  • oj_windows.bat (Windows)
  • oj_linux.sh (Linux)
  • oj_macosx.command (MacOSX)


ATTENTION

Windows users please edit oj_windows.bat, as described in ca. line 8

rem -- uncomment to use 'java' for console output, if unset defaults to 'javaw' for background jre --
rem set JAVA_BIN=java

TO (remove the comment command rem)

set JAVA_BIN=java


OJ should start and additionally a console window should appear, similar to this
Gps-consolemac.JPG
containing messages of GPS extension during startup. Like this
Loading de.soldin.jump.gps.GPSExtension
de.soldin.jump.gps.GPSExtension is in: jar:file:lib\ext\gps.jar!/
GPS (de.soldin.jump.gps) base is: Z:\openjump-1.3.1\lib\ext\gps.jar
...


Linux users: If the console does not come up, please

  • open the Terminal or Console application of your distribution
  • navigate to OJ bin folder
  • execute oj_linux.sh on command line


Now look for a part that starts like this
RXTX Loader on: 'Windows 7' 'amd64'
RXTX detected basefolder as: 'file:/Z:/openjump-1.3.1/lib/ext/gps.jar'
RXTX libfolder set to: 'Z:\openjump-1.3.1\lib\ext/'
RXTX Loader will look for native libs in (listed in order of priority):
1. Z:\openjump-1.3.1\lib\ext//rxtx/
2. Z:\openjump-1.3.1\lib\ext//rxtx/<os>/<arch1,arch2,..>/
3. java.library.path which is currently set to 'C:\Windo.....


A little later on there will be either
RXTX succeeded loading: 'Z:\openjump-1.3.1\lib\ext\rxtx\windows\1_64bit\rxtxSerial.dll'
or something like
RXTX unsuccessfully tried: 'Z:\openjump-1.3.1\lib\ext\rxtx\windows\1_64bit\rxtxSerial.dll'
RXTX unsuccessfully tried: 'Z:\openjump-1.3.1\lib\ext\rxtx\windows\2_32bit\rxtxSerial.dll'
Z:\openjump-1.3.1\lib\ext\rxtx\windows\2_32bit\rxtxSerial.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver

If RXTX succeeded loading is shown, then continue with 'RXTX load's but serial device is missing'.

If no RXTX succeeded loading appeares, than the native library failed to load. Continue with 'RXTX native driver won't load / crashes'.

RXTX native driver won't load / crashes

Try to find a native library for your operating system. For example on [1] or [2]. Put the file librxtxSerial.<dll,so,jnilib> into

<OJ_HOME>/lib/rxtx/

to force the GPS extension to try to load it.

RXTX load's but serial device is missing

Make sure the serial device for the GPS receiver was created. Write down it's name. Add

-Dgnu.io.rxtx.SerialPorts=<devicename>

e.g.

-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0

to the parameters of your java runtime and force RXTX hereby to detect this device.

Usage

Enable Tracking

Close the GPS Options window and turn on the GPS Tracker from the GPS menu (Fig. 4).
OJ GPS 04.png
Notice that GPS coordinates are shown in the bottom left corner. Tracking information is shown right field.
Coordinates are processed with the CTS Extension if different input and output systems were selected (Fig. 4 shows plain WGS 84 coordinates).
Fig. 5 shows how to select UTM zone 35N output and Fig. 6 shows the transformed GPS coordinates.
OJ GPS 05.png
OJ GPS 06.png

together with vector files

The next example illustrates how to use GPS plugin together with a shapefile. Shapefile in this example is OpenStreetMap roads, downloaded from Geofabrik http://download.geofabrik.de/osm/europe/ Roads shapefile is in the WGS 84 projection (EPSG:4326) and when GPS plugin is configured accordingly the location seems to be somewhere in the Southern Finland (Fig. 7).

OJ GPS 07.png

Closer zoom and slight styling with OpenJUMP styling wizard shows the location more accurately

OJ GPS 08.png


with raster images, vectors from a database, and other projections

Figures 9 and 10 are showing how to add two vector layers from a PostGIS database with the OpenJUMP standard Run Datastore Query tool. The first one is creating a park bench layer, the second finds out some waste baskets. Data in again OpenStreetMap data which is downloaded from Geofabrik in native osm format and imported into PostGIS database with osm2pgsql utility. Osm2pgsql was run with the -k parameter for getting all the OpenStreetMap tags into the database. After import the data in the PostGIS database was reprojected into EPSG:3067 projection, which is about the same as EPSG:32635.

OJ GPS 09.png

OJ GPS 10.png


Figure 11 shows an OpenJUMP task that is ready to be used for a field survey.


OJ GPS 11.png


Map layers in this task are

- Raster base map rendered by Mapserver from OSM data - The bench layer created as described above (Fig. 9) - The waste_basket layer created as described above (Fig. 10) - New bench layer for collecting missing benches - New waste basket layer for collecting missing waste baskets

Screen capture shows also two nice OpenJUMP features:

- View - Map Tooltips is selected for getting the mouse-over functionality

- EZ-Buttons are used for giving a large button for recordind GPS locations. F1 function key can be used for the same purpose


Finally, Fig 12. shows the results of a rapid field visit. Two benches and three waste baskets were recorded.

OJ GPS 12.png