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...
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
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 :