The Java Map Viewer (with no name)

This is a work-in-progress demo release of the map viewer. It is packed full of experimental features and, frankly, flaky stuff. You may well come across parts (especially plugins) which don't work as advertised.

Installation

The archive is in JAR format. Unpack the archive in a directory of your choice. You require at least JDK 1.2.2 installed, although JDK 1.3 is recommended. If you want to import TIFF or PNG images you require Java Advanced Imaging to be installed. If not, you should remove the file plugins/jai-plugins.jar to avoid annoying messages on startup.

Quick Start

Follow these instructions for a quick demonstration of how the map viewer works.

Run the Viewer

To run the viewer, you need Java in your path. You can then go to the directory containing the map viewer and type:

java -cp mapviewer.jar -mx128m com.jhlabs.map.MapApplication

For convenience, there's a shell script called mapv which does this for you. On Solaris you can just run this. On Windows you can rename it to mapv.bat and edit it for your system. On Mac OS X, there is a shell command called mapv.command which is double-clickable and changes some options which make the viewer look better on OS X. Proper double-clickable launchers for Windows and Mac OS X are on the way....

If all goes well, once you've started the viewer you should see the map viewer splash screen followed by a map viewing window. If you've got this far, congratulations! Nothing can go wrong now.

The following paragraphs tell you some things to try in order to explore the viewer.

Open a Map

Invoke File->Open... to open a map. Select the file "world.jmv". This should result in a map of the world. This map actually consists of four layers, two graticule layers, one vector layer and a daytime shading layer (which is hidden). The first graticule layer draws the map frame including the blue background color. The second graticule draws the grid lines.

Navigate the Map

Select the Pan tool (the one with the hand icon). Pan the map by clicking and dragging. Select the Zoom tool (with the magnifiying glass icon) and drag out a rectangle to zoom into. Hold down the control key while dragging to zoom out. Finally, invoke View->Zoom to Fit to view the whole world again.

View the Layers

Invoke View->Layers and Styles. The layers panel will appear at the left of the window. Select the Daytime layer and click in the "visible" column to make the layer visible. You will need to click on the refresh button in the toolbar for the layer to actually be drawn. Select the bottom graticule layer and click on Edit. This shows an editing dialog for the layer. Click on the Properties tab to change the lines and colours of the graticule.

Add a New Layer

Now try adding an extra layer: Invoke File->Import... and select the file data/World/earth-topo.jpg. This is a relief image of the world which will hide the other layers. Select it in the Layers panel and click on "Back" to move it back in the layer stack. Alternatively, edit it and change its opacity in the dialog.

Do Some Drawing

To draw, you need to create a new layer. Click on "New" in the layers panel and select "Vector Layer". Then choose one of the drawing tools, such as the Rectangle tool and draw some features.

Create a Style

The coastline is unfilled. To fill it, we need to create a feature style. Click on the Styles tab at top left and click "New" to create a new style, followed by "Edit" to edit it. Alternatively, choose the top style which should already be created. Next, go back to the Layers panel, click on the Coastline layer to make it the active layer, then invoke Edit->Select All to select all the coastline features. Go back to the Styles panel and click "Assign" to assign the selected style to these features.

Add an Effect

Select the coastline layer and press the "Edit" button. In the layer editing dialog, select the "Effects" tab and press the "New" button. Choose "Drop Shadow" as the new effect and just press "OK" in the drop shadow dialog when it appears. Press "OK" in the layer editing dialog. You should now see a nice drop shadow around the coastlines. This is quite slow to draw, so you might want to turn it off while navigating. To do this, select "Interactive Rendering" from the "View" menu.

Change the Projection

Warning: a lot of the projection code is a bit dodgy so some projections may not work correctly. I'm working on it.

Select "Set Projection..." from the "View" menu and choose "Orthographic Azimuthal". You should now see the Earth as it looks from space. Select the projection centering tool (the diamond with a dot in) and click at a point on the Earth you want to view. Try some other projections: Lambert Conformal Conic and Molleweide are nice.

Notice how slow everything is now. This is because the images are being warped by the map projection which means that a lot of floating point maths is being done for every pixel. In order to improve speed you can turn off image layers while navigating. The daytime layer is also an image-processing operation and is quite slow, as are most layer effects,

Render an Image

Select "Render Image" from the "File" menu. Type in 400 as the image width and 200 as the height, then select "JPEG" as the image format and press "Render" to create an image. You can preview the image in a new window and can choose to render the whole map (good for the World map) or just the current view.

What Next?

That was a very basic tour of the core map viewer. There are many plugins which provide additional capabilities such as viewing raster layers from remote servers, displaying multi-resolution images, importing foreign file formats such as Shapefiles or DXF, converting between different coordinate systems, exporting PostScript or images, querying databases for object attributes, or providing a scripting language.