BCS Logo

Grid Projection Demo

This applet demonstrates the ability of the BCS Grid DataBlade to resample gridded data to a desired resolution and in different mapping projections.

Important Note: The current implementation of this demo requires Java2 Plugin, version 1.5 or higher. The Java2 plug-in is part of the Java Runtime environment which can be downloaded by following the appropriate "Java Runtime Environment" download link at http://java.sun.com/javase/downloads/index.jsp [Java 1.4.* has an intermittent problem displaying Icon images properly that causes the extracted images to be corrupted.]

Running the demo:

The 600 by 300 pixels raster image of the World displayed above is a representation of a higher resolution image of 8192 by 4096 pixels, with each pixel being represented by three floating point values (red, green, and blue), for a total size of 384 Mbyte. This large data grid (i.e., the raster image) has been stored inside an IBM Informix database using BCS's innovative Grid DataBlade.

To resample the grid according to a projection, you should first select a particular class of projections (such as Aitoff, Mercator, or polyconic). Note that different projections have different parameters, which are displayed interactively on the image of the World as lines of different colors. You can adjust these parameters by dragging them with the mouse (left button or equivalent). After you modify the parameters or the type of projection selected, you will see that the "srtext" window beneath the World map is then updated. This srtext is the industry standard well-known-text form of the spatial reference system and can be used with current GIS technology.

You can modify the size of your extracted image by setting the "X pixels" and "Y pixels" fields, and you can specify the area it should cover on the extracted map using the "X distance" and "Y distance" fields. As a rough rule of thumb, you'll get sharp looking imagery at roughly 2 pixels per 10 kilometers. At about 6-8 pixels per 10 kilometers, the raster structure of the original image becomes evident in the projected image.

On the image of the World above, you will see a small solid-filled red box. That box is a handle for the bottom left corner of the area to be extracted: by dragging it with the mouse, you can pick an area to extract and reproject.

Extending from the handle (solid red box) is a hollow box with thick dashed red lines. This hollow box denotes the area that the extraction will be resampling, when projected on the image of the World. Different projections and projection parameters will cause the box to deform in different ways, reflecting how a rectangular box in the chosen projection would be projected onto the long-lat grid used by the World image.

If you now press the Extract button, the Grid DataBlade will proceed to generate an image by resampling the stored 8192 by 4096 grid according to the specified projection. This reprojected image will appear in a separate small floating window, which you can maximize. The text of the actual query sent to the database server appears in the "query" window.

Please note that not all combinations of projection class, projection parameters, and box positions are valid. For instance, one of the parameters for the stereographic projection is the "latitude of origin", whose only valid values are +/- 90 degrees (i.e., the North or South poles) but nothing in between. Also, some projections, such as Mercator, are sensitive to having the extract box straddle a meridian line that is exactly half way around the World from the "central meridian".

Invalid combinations have two effects: the hollow red box disappears, and the Extract button becomes disabled (grayed out to indicate that it cannot be selected at present). With a little knowledge about the nature of the projection in question (and/or a little experimentation), it is quite easy to adjust the parameters suitably to achieve a valid combination.

Here's how it works:

This applet makes use of the BCS Grid DataBlade and the IBM Informix Spatial DataBlade, both residing inside an IBM Informix Server.

The srtext is built from one of more than 40 different example spatial reference text strings (one for each class of projections). The applet also derives its knowledge of which parameters are needed by a particular projection from the list of parameters that it sees in the projection's template.

To generate the red-dashed-line hollow box denoting the extents of the chosen projection, the Spatial DataBlade is first used to reproject the location of the handle from long-lat coordinates to the desired projection. A box of the specified dimensions is then built by adding the X distance and the Y distance to the projected coordinates of the handle and linearly interpolating along the edges of the resulting rectangle in the space of the projection. The interpolated points are then reprojected back to long-lat coordinates, and these are displayed as the (possibly non-rectangular) red-dashed-line hollow box.

To resample the raster image, a query (shown in the "query" window) is run on the database server, executing a Grid DataBlade user-defined routine. This query contains the srtext, the number of desired pixels, the projected location of the solid red box, and the size of the area covered. The Grid DataBlade produces the final projected image by using the Spatial DataBlade to perform projection transformations for each pixel in the space of the projection, and to locate and sample the color value at the corresponding location in the original image.

To contact BCS.

Copyright BCS