Return to LAS FAQ
How can I use a different image in the map applet.
The map provided with LAS is fine for global datasets but inappropriate for regional dataset. Or you may simply wish to display a map of your own creation.
As of LAS v5.2, many aspects of the user interface are configurable. User interface information is stored in a named <default> and attached to a dataset or variable with <properties> tags in the dataset .xml file:
<properties> <ui> <default>file:ui.xml#Adriatic</default> </ui> </properties>
As in this example, all user interface properties are (must be) defined in the file named ui.xml. Each <default> defines user interface behavior and consists of descriptions of the operations, views, livemap and options. Detailed information is available in the documentation on User Interface behavior. The following example provides for a new <default> which uses a detailed image of the Adriatic.
<images> <image name="Image_Adriatic" url="gifs/adr_2min.gif" bounds="8,25,39,47"/> </images> <menus> <menu type="regions" name="Regions_Adriatic"> <item values="12,20,40,46">Full Region</item> </menu> </menus> <maps> <map type="livemap" name="Adriatic"> <image href="#Image_Adriatic"/> <menu href="#Regions_Adriatic"/> </map> </maps> <defaults> <default name="Adriatic"> <map href="#DefaultOperations"/> <map href="#DefaultViews"/> <map href="#Adriatic"/> <map href="#DefaultOptions"/> </default> </defaults>
The <default> named "Adriatic" references a <map> (a container) called "Adriatic" which references a <menu> of type region called "Regions_Adriatic" and an <image> called "Image_Adriatic". The region menu may have one or more <item> elements defined where the values are the left, right, bottom, top coordinates of the named region in degrees. The <image> element points to an image of your creation and passes the left, right, bottom, top coordinates of the edges of the image in degrees. All other elements used in the <default> reference elements defined in ui.xml.
To add this functionality to your LAS you might store the example above in a file named ui_Adriatic.xml and reference it in ui.xml as follows:
<!DOCTYPE spec SYSTEM "spec.dtd" [ <!ENTITY ui_Adriatic SYSTEM "ui_Adriatic.xml"> <!ENTITY StdOptions SYSTEM "options.xml">]>
<lasui> &StdOptions; &ui_Adriatic; ...
After attaching the new <default> to a dataset you simply remake the server try it out.
Note on images: The map applet does a straight linear interpolation to translate pixel coordinates into lat-lon coordinates. Using images which do not retain this relationship will result in output plots that don't look like the region selected. If you are using Ferret to generate your images you should probably use the mp_plate_caree.jnl script. Here is an example for creating a map of the northeast Pacific:
set mem/size=20 set data etopo20 set wind/siz=.5 palette dark_land_sea set region/x=-160:-124/y=-30:60 go mp_plate_caree set grid rose go mp_aspect shade/nokey/lev=(-10500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000)/nolab rose, x_page, y_page ! get axis lengths from previous plot and make a new plot ! where the plot takes up all the space ppl size ($ppl$xlen),($ppl$ylen) ppl axlen ($ppl$xlen),($ppl$ylen) ppl origin 0,0 shade/nokey/lev=(-10500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000)/nolab rose, x_page, y_page frame/file=EasternPac.gif ! after saving the file you will want to use xv or similar package to crop itIn LAS v5.2 you will need to place the custom image in
In LAS v6.0 the custom image should go in
You will need to run the las/configure script to have this image installed in the servlet area. Alternatively, you may place an additional copy of the image in $lasroot/las_servlet/jakarta/webapps/las/classes/gifs. If you your Tomcat server is installed elsewhere, it should go in $JAKARTA_HOME/webapps/~las_name~/classes/gifs. This is where the image would have ended up had you run the configure script.
Jonathan Callahan: Jonathan.S.Callahan@noaa.gov
Last modified: Oct. May 20, 2003