The GeoTIFF reader

The GeoTIFF reader (see GeoTIFF format) is based on some extension packages such as Batik Apache™ TIFF Reader, an open source API included in the JViews Maps jar files.
The GeoTIFF format is an extension of the TIFF (Tagged Image File Format) format. The TIFF format is an image file format that allows tags to be inserted in the file. These tags give information about the image contained in the file, such as the resolution, the number of samples per pixel, and so on. The GeoTIFF extension adds specific cartographic tags that give geographic information about the image contained in the file, such as the coordinate system in which the image is represented, and the location of the image in this coordinate system.
The official TIFF specification can be found on http://partners.adobe.com/public/developer/tiff/index.html.
More information about the GeoTIFF format can be found at:
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at <installdir> /jviews-maps810/samples/mapbuilder/index.html

The IlvRasterGeoTiffReader class

The IlvRasterGeoTiffReader class is a GeoTIFF file reader that creates reprojectable, stylable, and pixel-on-demand images.

Creating an image reader

You need first to create an image reader, and then add the image file to be read:
IlvRasterGeoTiffReader imageReader = new IlvRasterGeoTiffReader();
imageReader.addMap(tiffFile);
The geo-reference information is decoded from the GeoTIFF file, by means of an IlvGeotiffReader.

Creating a data source

Once you have created the reader, you need to create a data source, which should be linked with the manager properties by inserting it into the data source tree:
IlvMapDataSource imageDataSource = 
IlvRasterDataSourceFactory.buildTiledImageDataSource(manager,imageReader,true,t
rue,null);
IlvMapDataSourceModel dataSourceModel = 
IlvMapDataSourceProperty.GetMapDataSourceModel(manager);
dataSourceModel.insert(imageDataSource);

Reading the data

You can then start reading your data:
dataSourceModel.start();
Starting the data source creates the necessary tiled layers, tile managers, and IlvRasterIcon instances to manage the pixel-on-demand feature and the progressive display of the geo-referenced image.

The IlvGeotiffReader class

The IlvGeotiffReader class implements the IlvMapFeatureIterator interface. The getNextFeature method returns an IlvMapImage geometry which contains a TIFFImage object. The TIFF image can then be rendered by the IlvDefaultImageRenderer to produce an IlvIcon, or be transformed by data sources into a tiled IlvRasterIcon.
The TIFF reader can take two parameters as arguments: the TIFF file name and a file that contains a connection between the tag describing the coordinate system used by the image and the corresponding WKT string. The reader retrieves the coordinate system of the image in a WKT format if the image contains the appropriate tag, and then retrieves the IlvCoordinateSystem through the IlvWKTCoordinateSystemDictionary class. This coordinate system is then available through the getCoordinateSystem method.
The default constructor, however, only takes the TIFF file name parameter and uses an internal WKT file (wktdictionary.txt) found in Rogue Wave® JViews jar files.
The reader can be used in the same way as any reader that conforms to the Maps reader framework:
IlvGeotiffReader reader = new IlvGeotiffReader(tiffFile);
IlvFeatureRenderer renderer = reader.getDefaultFeatureRenderer();
IlvCoordinateSystem coordSys = reader.getCoordinateSystem();
if (coordSys != null)
    manager.setNamedProperty(new IlvCoordinateSystemProperty(coordSys));
else
    manager.removeNamedProperty(IlvCoordinateSystemProperty.NAME);
IlvCoordinateTransformation tr =
    IlvCoordinateTransformation.CreateTransformation(coordSys, coordSys);
IlvGraphic g = renderer.makeGraphic(f, tr);
manager.addObject(g, false);