Return to LAS FAQ


Replacing the map applet image


Question:

How can I use an alternate image in the map applet?

Example:

Here's the interface zoomed in on a relief map of Monterey bay.

[Output Graphic]

Solution:

The file lasxml/ui/upper.html passes information to the map applet about which image to use and what the corresponding ranges are. Currently, the image is loaded when the interface is initialized; there is no way to associate a different image with each dataset or variable. .

Here's what the applet related tags in upper.html normally look like:

<APPLET CODEBASE="LiveMap/classes/"
  ARCHIVE="LiveMap_30.jar"
  CODE="LiveMap_30.class"
  NAME="map" MAYSCRIPT WIDTH=525 HEIGHT=160>
 <PARAM NAME=base_image VALUE="gifs/java_0_world_20k.jpg">
 <PARAM NAME=toolType VALUE="XY">
 <PARAM NAME=img_x_domain VALUE="-180 180">
 <PARAM NAME=img_y_domain VALUE="-90 90">
 <PARAM NAME=tool_x_range VALUE="-180 180">
 <PARAM NAME=tool_y_range VALUE="-90 90">
 <PARAM NAME=debug VALUE="true">
</APPLET>

And here are the changes that were needed to include the map of Monterey bay:

<APPLET CODEBASE="LiveMap/classes/"
  ARCHIVE="LiveMap_30.jar"
  CODE="LiveMap_30.class"
  NAME="map" MAYSCRIPT WIDTH=525 HEIGHT=160>
 <PARAM NAME=base_image VALUE="gifs/mbaflyrec768noblank.jpg">
 <PARAM NAME=toolType VALUE="XY">
 <PARAM NAME=img_x_domain VALUE="-122.55204 -121.75527">
 <PARAM NAME=img_y_domain VALUE="36.43817 37.04672">
 <PARAM NAME=tool_x_range VALUE="-122.55204 -121.75527">
 <PARAM NAME=tool_y_range VALUE="36.43817 37.04672">
 <PARAM NAME=debug VALUE="true">
</APPLET>

The image itself must be located in the lasxml/ui/LiveMap_30/classes/gifs/ directory. The image doesn't need to be a .gif file despite the name of the directory. The default image, java_0_world_20k.jpg, is 749x374 pixels. This image was originally 60k and we used Macromedia's Fireworks product to reduce the size to 20k.

You may load an image of any size and aspect ratio and the applet will scale the image to fit within the applet area. We recommend, however, that you create an image that has an aspect ratio (y:x) of 1:2 so that it fits exactly into the area reserved by the applet for images.


Jonathan Callahan: Jonathan.S.Callahan@noaa.gov
Last modified: August 10, 2000