Table of Contents
GPS is widely used for the determination of the user's position. To show friends and colleagues the attended hiking track of the last weekend or to visualize the difficult conditions and heights is one of the major applications of GPS positions.
Besides GPS devices with included mapping software, websites such as GPS Visualizer ([Schneider2008]) and downloadable software offer services to draw a map or a profile. Even conversions in other file formats such as Google KML ([GoogleKML2008]) and plain text are possible. But only a few of the tools show tracks in interactive maps with high resolution, a connection between the profile and the map is missing. In most of the cases, the profiles can only be created as separate service. Furthermore, the navigation in the maps and especially the adaptation of background maps to the map scale is missing. In the following chapter,existing tools and their pros and cons are presented.
This website GPSVisualizer ([Schneider2008]) offers three services: a service to convert GPS tracks and waypoints in text-based tables, GPX ([Topografix2007]) or KML files or PNG, JPEG and SVG files, a profile generation and a map drawing service to convert the profile or the map respectively in PNG, JPEG or SVG format ([Schneider2008]). In the map drawing service, up to three tracks can be uploaded. Typically, Google Maps images can be used as background maps but also low resolution satellite images, e.g. from Landsat or SRTM, can be chosen. Additionally, settings can be made to color the track using its attributes, e.g. the height, velocity or distance and adapt the width of the path. While the profile is totally static, in the SVG version of the map the user can move the tour information window and switch the track on and off. If one choses as background the Google Maps image, the basic zoom and pan functionalities of the Google API are used. It mainly consists of a zoom slider, providing some zoom levels, and four pan buttons as well as a "back to the last results" button. Profile and map of a track have to be generated and visualized totally separated. No interaction is possible. The graphic is improvable. The service can handle URLs.
Google Earth ([GoogleEarth2008]) is a 3D visualization software, using high resolution satellite images and aerial photographs for the visualization of the earth's surface. Besides raster images mapped over a terrain model, vector-based KML and GPX files can be imported. The GPS tracks will be projected on the digital globe and can be observed from any direction and angle while the image quality increases or decreases with the continuous setting of the observation height. Furthermore, one can fly over the track and follow the waypoints. Since the flight takes place in a very high altitude, this experience is very disturbing because for each waypoint the direction and viewing angle will be changed. The style properties of the track such as color, width and transparency can be changed. While the visualization of the track is very impressive, the interpretation of the background images is only feasible for experienced users. Disadvantages are the installation of the software and the slow loading of the background images (with a slow internet connection). A profile will not be created, and printing is only possible in small screen resolution. Money will be charged for Google Earth Plus, but here GPS tracking in realtime is possible.
Yabadu ([Yabadu2008]) is a website for the online visualization of GPS tours and tracks and an online community which shares their tracks. After a registration, the user has access to the large tour database and can upload his own tracks. In Yabadu, GPS tracks can be imported as GPX or directly downloaded from the GPS device. The track can be edited or even totally new tracks can be created, additional information such as comments and symbols for points of interest can be added to the map. As background map, the Google Maps API is used. For the area of Germany, Switzerland and Austria, also the official Topographic Maps in the scale of 1 : 50.000 are offered for free ([Yabadu2008]). The download of the Topographic Maps in PDF format will be charged. The navigation consists mainly of Zoom and Pan functionalities, there is also a possibility to interact between height profile and map. Via click on a waypoint in the profile, the appropriate position will be highlighted in the map. In the other direction, the interaction between the map and the height profile does not work. There is also a possibility to animate the GPS track (a moving circle follows the track). The graphics quality is good. The service can handle URLs.
The GPS-Track-Analyse.NET ([Domin2004a]) is a free program to analyze GPS data and visualize them as graphic ([Domin2004b]). The software is only available in German and uses the runtime library of Microsoft's .NET framework 2.0. Various GPS formats such as GPX and Garmin MapSource can be imported and visualized as two- or three-dimensional height profile. Tracks can be edited in the 2D version. Additionally, a velocity diagram and a waypoint table can be shown and easily edited with few clicks. One of the strengths of the program is the statistical analysis of the track, including a slope analysis with the representation as diagram. Photos can be embedded. Tracks can be exported as GPX, KML or KMZ, tables and diagrams can be printed and exported as raster images. In the program, a map representation is not available. Therefore, an interaction between the map and the profile is not possible.
Fugawi Global Navigator is a commercial software for the visualization of GPS tracks in 2D and 3D ([Northport2007]). The import and export of waypoints, routes and tracks in GPX, Google Earth KML, ESRI Shapefile as well as the loading and uploading of the tracks to the GPS device is possible. The representation can be combined with photos and sounds and edited in the software. Elevations and profiles of the track as well as the speed and distances to go can be used to analyze the track. The software supports a variety of formats for the background map, e.g. Garmin IMG, GeoTIFF, TIFF+TFW as well as any scanned raster map in BMP, GIF, JPG, PNG, PCX or TIF in combination with a map datum and the coordinates of three points. Disadvantages of the application are the complex usability and the price of appr. 150 euros, a plus is the support for a lot of GPS devices.
To summarize this chapter, for the visualization of GPS tracks one can use a broad range of tools, reaching from downloadable software to web services. The quality of the map and track representation differs, the prices vary too. While the software needs to be installed, a web service can be used with each browser and is therefore the simpliest and fastest way for the GPS track visualization. Available web services such as GPSVisualizer and Yabadu offer free services to cover this field but they need a registration and charge the user for each map download. The two services also miss a mutual interaction between the track in the map and the profile. The quality of the background map as well as the usability is improvable, in the case of GPSVisualizer the focus is mainly on the conversion and testing of GPS data.
Since a lot of people want to visualize and share their GPS data, they need a fast, intuitively and easy usable way but expect also a good graphical quality of the background maps and the track since the service will be used for the analysis of the track and its surroundings. A good way to satisfy this needs is the development of a web service, offering upload and sharing possibilities. Therefore, the web service should:
allow the upload of data from files and URLs
automatically check uploaded files of consistency
use high quality background maps
draw the track and the profile as vector graphic (high quality)
allow interactivity between map and profile
allow intuitive navigation (e.g. zoom fence)
export in a common format for download and printing (e.g. PDF)
provide an URL for the sharing of the track
be fast and easy to use
be free and without registration
Since none of the above mentioned tools met all of these requirements, a new web-based tool for the visualization of GPS tracks using open source tools was developed.
To develop such a service, a workflow and functions for the application were determined. First, the user chooses his favorite language. This is important for Swiss people since German, Italian and French are native languages. Additionally, English was added as typical "internet language". As a second step, the user can upload a GPS track as GPX file, whether stored locally or on a web server. This GPX file and its URL needs to be checked for validity. This check includes the analysis of
the file extension,
the file size,
the XML conformity.
In a next step, the file is copied to the web server and all trackdata are read and stored in an array. This array is used afterwards to calculate the map extent, the bounding box coordinates and the height and time differences. The latitude/longitude coordinates will be converted in this step to Swiss coordinates. Now, the track, the profile and the profile legend (colored height layers and labels) will be created from the array and displayed as interactive map (needs a mapping service) and profile on the screen. By clicking on a button, the user can export his track as PDF (needs a conversion from a static version of map and profile) and as direct link to the interactive map. In a few mouse clicks, the user can interactively explore his track and its surroundings, using the zoom, pan and mouseover functions for the display of track information. A help is offered explaining the graphical user interface, the mouse effects and listing the tested browsers.
As main technique, a combination of PHP and SVG is used. Sent via POST method from a wrapped HTML form
(form_upload.php), the URL or file of the track is validated and analyzed with a PHP script (upload.php). Here, the
parameters of the form are checked (e.g. the maximum file size). As a next step, the URL or file name is splitted to
check the extension. Afterwards, the PHP XML parser functions, such as
xml_parse($parser,$xmlcontent,feof($open)) are used to check the file for XML validity. As a last
step, the GPX file is validated with the GPX schema, using the PHP DOM functions, such as
$dom_url_file->schemaValidate('gpx.xsd'). After passing the validation, the GPX file is uploaded
to the carto.net server ([NeumannWinter2008]). With PHP, also the profile, the track and profile
legend is created as SVG fragments (dom.php). These fragments will be used to fill them in the SVG framework
of an interactive map (map.php) using the ECMAScript functions
(see tutorial [Neumann2007b]). As framework for the application, the SVG GUI framework of
[Neumann2007a] was used, consisting of several ECMAScript files for navigation (zoom buttons,
zoom slider, zoom fence, pan, history, reference map) and a SVG file.
On the same server, raster images of Swiss Topographic Maps in different scales are provided as a Web Map Service for educational projects. This WMS is based on a UMN Mapserver ([UMN2008]) and is also integrated in the SVG GUI framework to provide the background information of the GPS tracks, using the calculated map extent and the bounding box coordinates (a tutorial can be found at [WilliamsNeumann2006]).
Parallel to the generation of the interactive SVG map, the PHP file svg2print.php creates a static SVG file in DIN A4 for the PDF export. In this static SVG file, the above mentioned SVG fragments of the track, the profile and the background map as well as track information, such as the track length, distance and time differences, are embedded. The generated file is moved on the carto.net server to the 'pdftemp' directory. Since the Batik rasterizer is installed on the same server, it can be used on demand to convert the SVG file to a PDF with the help of the PHP file print.php, using the following commands:
$command = '/usr/bin/java -Xmx512M -jar /...directory.../batik/batik-rasterizer.jar -d /home/...directory.../gpstracks/pdftemp/'.$filename.' -m application/pdf -w 793.7 -h 1121.4 -onload '.$svgurl; $command = escapeshellcmd($command); $result = exec($command);
In addition to the PDF export, a link to the interactive map was generated with PHP and presented parallel to the link to the generated PDF file. With a cronjob, temporarily created files will be deleted at the end of the day.
During the development of the application, several problems had to be solved. The intended multi-user-support (different users upload their files at the same time) leads to two problems: Uploaded GPX files could have the same file name, and only the owner of the file should be allowed to share his track information. A solution is the use of randomized session keys:
$sessionid = uniqid(rand()); //sessionid created session_id($sessionid); session_start();
This session key is attached to the file name, so that mix-ups are unlikely.
A second problem was the use of hyperlinks in SVG to open SVG files of the same domain, e.g. the help file, in a
new window. Regarding the SVG 1.1 specification ([W3C2003]), the anchor tag with the attributes
target="_blank" could be used. Due to different
implementations in the browsers and plugins, the behaviour varies considerably. The following options were
tested with Windows XP SP3:
|Browser / Plugin||xlink:show="new"||target="blank"||target="_blank"|
|Opera 9.51||new window||new window||new window|
|Mozilla Firefox 3.0.1||same window||new window||new window|
|IE 6 + ASV3.03||same window||new window||new window|
|IE 6 + ASV6prealpha||same window||new window (blocked by IE popup blocker)||new window (blocked by IE popup blocker)|
|IE 7 + ASV6prealpha||same window||nothing happens||nothing happens|
|IE 7 + Renesis1.1.1||same window||same window||new window|
Table 1. Open a new window: Behaviour of browsers and plugins
With an ECMAScript of Bruce Rindahl ([Rindahl2008]), a consistent behaviour could be achieved.
Since the application was designed for different languages, a language switch had to be accomplished. Via transfer of the URL parameter lang (= DE, EN, FR or IT) from file to file, the appropriate language variables of the included lang.php file could be used to adapt the form, the error messages and the map legend to the selected language.
The multiple use of the SVG file
gps_title.svg for the interactive version (embedded in a HTML file)
and the print version (embedded in a SVG file) could not be accomplished with one file, since in contrary to the
embedding in SVG for the embedding in HTML an XML header is necessary.
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
A solution would be the introduction of a PHP or ECMAScript function
omitXmlDeclaration() for the
removal of the XML header.
As a result of the above mentioned needs, a GPS visualizing tool was programmed with SVG, PHP and ECMAScript as well as with the UMN Mapserver and the Batik Toolkit. Here, the track can be uploaded and automatically visualized in a map and profile with few mouseclicks. With the help of ECMAScript, the user can interactively explore the track in the map and the connected profile. As export options, a PDF version and a link to the interactive map can be used to share the track information. The tool is available on www.gpstracks.carto.net ([SchnabelBreitfeld2008]) and was tested with the newest versions of Opera, Firefox, Internet Explorer with Adobe SVG Plugin. A documentation will be available until the end of this year, integrated in a Diploma thesis currently written at the Dresden University of Technology.
In the future, some improvements will be made to adapt the PHP language file with the two remaining Swiss
native languages French and Italian. Additionally, waypoints, routes and the display of multiple tracknames
should be supported. Currently, an adaptation to other countries is not planned but easily possible (3 small
htoCh() in the PHP file dom.php
need be changed to the appropriate country coordinates; viewboxes of the WMS, main map and reference map
must be adapted). An usage of the GPS Babel ([GPSBabel2008]) conversion tool on the
carto.net server is planned to convert various tracks to GPX and use them in the application.
[Domin2004a] Copyright © 2004. GPS-Track-Analyse.NET. http://www.gps-freeware.de . last accessed: July 2008.
[Domin2004b] Copyright © 2004. GPS-Track-Analyse.NET Description. http://www.gps-freeware.de/Beschreibung.aspx . last accessed: July 2008.
[GoogleEarth2008] Copyright © 2008. Google Earth. http://earth.google.com . last accessed: July 2008.
[GoogleKML2008] Copyright © 2008. Google KML Documentation. http://code.google.com/apis/kml/documentation/ . last accessed: July 2008.
[GPSBabel2008] Copyright © 2008. GPSBabel. http://www.gpsbabel.org . last accessed: July 2008.
[Neumann2007a] Copyright © 2007. Navigation Tools for SVG Maps. http://www.carto.net/papers/svg/navigationTools/ . last accessed: July 2008.
[Neumann2007b] Copyright © 2007. Network Requests with getURL()/postURL() and XMLHttpRequest(). http://www.carto.net/papers/svg/network_requests/ . last accessed: July 2008.
[NeumannWinter2008] Copyright © 2008. Carto.net. http://www.carto.net . last accessed: July 2008.
[Northport2007] Copyright © 2007. Fugawi Global Navigator. http://www.fugawi.com . last accessed: July 2008.
[Rindahl2008] Copyright © 2008. Open in New Window Solution. http://tech.groups.yahoo.com/group/svg-developers/message/60197 . last accessed: July 2008.
[SchnabelBreitfeld2008] Copyright © 2008. Visualization of GPS Tracks with SVG. http://www.gpstracks.carto.net . last accessed: July 2008.
[Schneider2008] Copyright © 2008. GPS Visualizer. http://www.gpsvisualizer.com . last accessed: July 2008.
[Topografix2007] Copyright © 2007. GPX 1.1 Schema Documentation. http://www.topografix.com/gpx/1/1/ . last accessed: July 2008.
[UMN2008] Copyright © 2008. UMN MapServer. http://mapserver.gis.umn.edu . last accessed: July 2008.
[WilliamsNeumann2006] Copyright © 2006. Integrating OGC WMS Services with SVG mapping applications. http://www.carto.net/papers/svg/ogc_wms_integration/ . last accessed: July 2008.
[W3C2003] Copyright © 2003. Scalable Vector Graphics (SVG) 1.1 Specification. http://www.w3.org/TR/SVG11/ . last accessed: July 2008.
[Yabadu2008] Copyright © 2008. Yabadu. http://www.yabadu.com/en/ . last accessed: July 2008.