GPSActionReplay

GpsActionReplay within a Web Browser (as an Applet)

As it is written in Java, GpsAR can be embbed in a Web Browser within an Applet, enabling replays available worldwide...


Demo

If you haven't ever seen GpsAR as an applet, you can check some of the on our replays' page.


How to for newbies

We show here how to make a first applet in the easier way

  • Create a directory named appletGPSAR
  • Copy the gpx file that you want to provide to the applet to the appletGPSAR directory and rename it demo.gpx
  • Copy the maps directory that is required by your gpx to the appletGPSAR directory. This directory MUST contain the default.maps (no other name)n and of course the jpg file(s).
  • Copy gpsar.jar from your distribution to the appletGPSAR directory
  • Copy gpsar.html from your distribution to the appletGPSAR directory

Here it is. This should work when double-clicking on gpsar.html. You can now copy appletGPSAR (FTP) to your site.

Remark: of course, you can rename gpsar.html to index.html so that your web-site automatically shows the applet rather than the content of the directory.

Important: once you've copied your maps directory, it's strongly advised to keep only the relevant map(s) really needed by your gpx. This means removing the jpg files, and removing their definition in the default.maps file. Do not forget that otherwise, all these maps will be loaded when visiting your applet, which takes bandwidth and time


Troubleshooting

Somtimes, people experienced a strange phenomenon with the GpsAR applet. They do all that is written above. They try it locally on their machine, and it works great. Then they copy it with FTP to their site, and the applet doesn't work. Usually, the reason is that Windows is too permissive, and allows non conventional use for naming files and directory. Once put on the web, it's not your windows but, often, a Linux system that has to cope with that, and it doesn't word. So, here are some recommandations:

  • Use names with no spaces, no special characters, and whose first characters isn't a number for your files and directory. Keep it simple.
  • Be carefull to the case-sensitive problem once on your site. For example, if you name the maps directory MAPS rather than maps, it will work on your system, but not once on the Web!
  • Make sure that the names of your jpg files in your default.maps file are exactly the same as the jpg files names they refer to. Once again, do remember the case problem...

How to for advanced users

What we've just seen above is very simple, since you just have to copy some files and directories, but isn't very handy when you want to provide several applets in your web site. Indeed, it implies to create as many directories as applet provided. Let's introduce here some parameters that enable more handy applets.

In fact, you can use 2 parameters when you launch the applet:

  • nomFichier (french for "fileName"...) is the parameter which sets the name of the gpx file to use. Hence, what was demo.gpx by default above can now be whatever name you wish.
  • maps is the parameter which sets the .maps file to use to load the map(s). Hence, what was maps/default.maps by default above can now be set to whatever name and relative location you wish. You will usually use maps/nameOfYourChoice.maps.

Why to use these parameters rather than using the gpsar.html file as it is and using the default names for gpx and maps? The reason is of course that this way, you can program it with php for example.

To finish, I provide below the PHP CODE I used for the Defi Wind replays. You will see that a only PHP page can provide the applet with different GPX and different MAPS, although there are only one directory, and one gpsar.jar. Here it is :


<html>
<title>Defi Wind 2005 sur GPSActionReplay</title>
<body style="background-image : url('fond_bois.gif'); color:white">
<h1><center>Defi Wind 2005</center></h1>
<h2><center>5 mai - 8 mai</center></h2>
<hr/>
<div align="center" style="font-size:20">
<?php

$numCarte=$_GET["numCarte"];
$manche=$_GET["manche"];

if (!isset($numCarte))
$numCarte=1;
if (!isset($manche))
$manche=1;

$carte[1]="maps/defiWind1.maps";
$carte[2]="maps/defiWind6.maps";

$description[1]="Jeudi 5 mai";
$description[2]="Vendredi 6 mai";
$description[3]="Vendredi 6 mai";
$description[4]="Samedi 7 mai";
$description[5]="Samedi 7 mai";
$description[6]="Dimanche 8 mai";
$description[7]="Dimanche 8 mai";

$nb=7;
for ($i=1;$i<=$nb;$i++)
{
if ($i != $manche)
print "<a href='index.php?manche=$i&numCarte=$numCarte'>Manche $i</a>";
else
print "Manche $i";
if ($i!=$nb)
print " - ";
}
print "<hr/>";
print "<span style='font-size:14'>";
if ($numCarte!=1) print "<a href='index.php?manche=$manche&numCarte=1'>Carte BASSE RESOLUTION (157 Ko) - </a>";
else print "Carte BASSE RESOLUTION (157 Ko) - ";
if ($numCarte!=2) print "<a href='index.php?manche=$manche&numCarte=2'>Carte HAUTE RESOLUTION (945 Ko)</a>";
else print "Carte HAUTE RESOLUTION (945 Ko)";
print "</span>";
?>

</div>
<hr/>
<center>
<h2>Manche <?php print($manche)?> (<?php print($description[$manche])?>)</h2>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = "800" HEIGHT = "700" codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
<PARAM NAME = CODE VALUE = "GPSARApplet.class" >
<PARAM NAME = ARCHIVE VALUE = "gpsar.jar" >

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">
<PARAM NAME = "nomFichier" VALUE ="manche<?php print($manche)?>.gpx"/>
<PARAM NAME = "maps" VALUE ="<?php print($carte[$numCarte])?>"/>
<COMMENT>
<EMBED type="application/x-java-applet;version=1.2" java_CODE = "GPSARApplet.class" java_ARCHIVE = "gpsar.jar" WIDTH = "800" HEIGHT = "700" maps="<?php print($carte[$numCarte])?>" nomFichier = "manche<?php print($manche)?>.gpx"/ pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT>

</NOEMBED></EMBED>
</OBJECT>

<!--"END_CONVERTED_APPLET"-->

</center>
</body>
</html>



Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'gpsactionreplay'@'172.20.245.57' (using password: YES) in /mnt/132/sda/2/c/gpsactionreplay/log/connect.inc.php on line 12
Could not connect