Raster data sources

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
All raster (image) data sources have a common API. To create your data source, you need to create an IlvRasterAbstractReader for the type of data to be read, and then use this reader to build a tiled image data source.

Raster reader classes

The raster reader classes for the different image formats are as follows.
GEOTIFF
IlvRasterGeoTiffReader
DTED
IlvRasterDTEDReader
GTOPO30
IlvGTopo30Reader
Non-geo-referenced images(*)
IlvRasterBasicImageReader
Images from OpenGIS compliant Web Map Servers
IlvWMSReader
(*) Non georeferenced images must be geo-referenced, see Georeferencing a nongeoreferenced image.

Creating a raster reader

To create a raster reader and add all image files to be read you can, for example, use the following code:

Creating a tiled data source

To create a data source for the reader:
IlvRasterDTEDReader reader = new IlvRasterDTEDReader();
for(int i=0;i<fileName.length;i++) {
  reader.addMap(fileName[i]); 
}
IlvMapDataSource DTEDDataSource = 
IlvRasterDataSourceFactory.buildTiledImageDataSource(manager,reader,true,true,null);
DTEDDataSource.setName("name in data source panel");
The IlvTiledRasterDataSource returned by the IlvRasterDataSourceFactory executes image reading in a background thread.

Georeferencing a nongeoreferenced image

To georeference a nongeoreferenced image, you can set the longitude and latitude image bounds:
reader.setImageBounds(0,-Math.PI,Math.PI/2,Math.PI,-Math.PI/2);
Alternatively, you can compute a more complex mathematical transformation and set it on the reader:
reader.setInternalTransformation(trans); 
Note
The non georeferenced image reader does not support multiple calls to addMap.

Images from OpenGIS-compliant Web Map Servers

This section gives information about the OpenGIS® Web Map Server (WMS standard). This International Standard specifies the behavior of a service that produces spatially referenced maps dynamically from geographic information. It specifies operations to retrieve a description of the maps offered by a server and to query a server about features displayed on a map. The standard is not applicable to the retrieval of actual feature data or coverage data values, but is applicable to pictorial renderings of maps in a graphical format. These capabilities are provided by a Web Feature and Web Coverage Service.
In a basic WMS, only a limited number of predefined styles can be applied to features. The mechanism that enables users to define their own styles is defined in the OGC Styled Layer Descriptor Implementation Specification. An SLD-enabled WMS retrieves feature data from a Web Feature Service and applies explicit styling information provided by the user in order to render a map.
The ISO/TC 211 also defines a standard for Web Map Servers, see ISO 19128.

Importing a WMS image

JViews Maps supports the import of images from a WMS server.
To create a WMS data source, use the following code:
URL url = new URL("http://geo.compusult.net/scripts/mapman.dll?
   Name=weather&REQUEST=GetCapabilities");
IlvWMSReader reader = new IlvWMSReader(url);
IlvWMSDataSource source = new IlvWMSDataSource(reader);
source.setManager(manager);