Rasters in MapInfo Pro

Rasters (Grids and Images) have always been an integral part of MapInfo Pro. To complement the basic visualisation and interrogation capabilities in MapInfo Pro, users could purchase Vertical Mapper (sold separately) to provide advanced raster processing capabilities and improved raster rendering features. In MapInfo Pro version 15 a new raster visualisation and processing add-in was created by MapInfo and sold as MapInfo Pro Advanced. It was designed to replace both the existing raster capabilities in MapInfo Pro and the Vertical Mapper processing package.

MapInfo Pro distinguished between Rasters and Grids. These were treated separately. A Raster, in this context, refers to a Located Image. Today we would call this a Raster with an Image field. A Grid referred to either continuous multi-banded data or classified data. Today we would call these a Raster with a Continuous field or a Classified field.

MapInfo Pro uses raster handlers and grid handlers to load rasters and grids of different formats. A variety are still shipped with MapInfo Pro. These files are in fact just DLL’s that have several standard function signatures that they must provide to allow MapInfo Pro to invoke them. Raster handlers have a *.rh* naming and grid handlers have a *.gh* naming convention. The trailing character in the extension can be ‘a’ through to ‘z’ and the order in which handlers are invoked by MapInfo depends on the alphabetical order of the handler names. Consequently, users can change the order by renaming handlers.

To load a raster, MapInfo Pro invokes the handlers in alphabetical order until one opens the raster successfully. Multiple handlers may be able to open a raster, but the one that gets to it first will be used.

MapInfo Pro Advanced provides a new handler and this ships with MapInfo Pro regardless of whether you have Advanced licensed. It has an RHA extension and is invoked ahead of all the legacy raster handlers.

The Advanced raster handler can load many different raster formats. Internally, it uses “Vehicles” which can open one or more formats, each of which is a “Driver”. Native drivers provide all the code to read and write rasters of many common formats. For more obscure formats, Advanced includes a driver that uses the open-source GDAL raster library. This can support dozens of raster formats.

The Advanced raster handler has a modern raster engine behind it and powering it. A single instance of this engine is created to load all rasters. Unlike legacy raster handlers, rasters opened by the new engine remain open whilst they are in use. This allows tile data and metadata to be cached and improves performance in many ways.

Unlike the legacy handlers, the new handler can open and display huge rasters and take advantage of overview resolution levels to provide linear performance at any scale. It provides this guarantee for any raster it opens by caching data in advance and storing it on disk if necessary. It also allows unlimited zoom-in by generating underview tiles.

Often you will see a *.PPRC file associated with a legacy raster. This is an overview cache and is similar to the .OVR file used in GDAL/QGIS/ArcGIS. In some cases, you will see a *.TPRC file which is a complete cache of the raster. You will see a GHX file that records how to render the raster and might cache statistics.

The Advanced raster handler will render the raster and supply a pixel image back to MapInfo for display in the map. This can lead to transparency issues.

Rendering properties are edited via the user interface in the Advanced Color dialog. You can also change many properties via the Raster ribbon. Color LUT style rendering is supported, where a data transform is applied to the raster to transform data to a color index. The color index is used to acquire a color from an external look-up table. RGB style rendering is also supported, where data transforms are applied to each of the Red, Green, and Blue channels to transform data to a color. In both cases, hill shading can be applied.

There are many limitations in this rendering system. A raster can only be rendered in one way in a MapInfo session. All rendering components must be drawn from the same raster. Imagery is color stretched by default, which is generally not desired. There are performance issues related to coordinate systems and reprojection. There are limitations around mixing different fields and cell sizes in a map. Transparency support is limited.

The MapInfo Pro Advanced Preferences dialog is used to set raster engine properties as well as various user interface defaults. Some properties are of key importance.

Generate Raster Overview Cache

For performance and quality, all rasters require an overview pyramid cache. If one does not exist, it will be created when you open the raster. It is stored in a *.PPRC file alongside the source raster and need only be prepared once. Some raster formats allow you to simulate and overview pyramid reasonably efficiently – without caching – by decimating the base level data on demand. Using this option can allow you to preview some large rasters immediately without any data processing. I recommend using the “Always” option to ensure that overview pyramids are always generated and stored.

Enable Block Access

This is an optimisation in the raster handler and it should always be enabled.

Disable Alpha Channel

Prevents alpha values (transparency) being used, if present.

Memory Cache Size

The cache in the raster engine stores raster tiles in memory and can improve performance by reducing disk access and decompression compute cycles. It is advantageous to set the cache to the maximum size, although it may consume up to 50% of your system memory and compromise the operation of other software. Note that if you are processing huge rasters that cannot be loaded into memory in full, the size of the cache may not matter much.

Native Raster Formats, GDAL Formats

This is a list of all the vehicles that load different raster formats. You can enable or disable these vehicles. Sometimes it can be advantageous to disable a vehicle for a particular format if you want a different raster handler to open it. If you have the GDAL native driver enabled, then you can also control what formats it will open via the GDAL Formats tab.

You might notice that only a small number of formats are listed in the GDAL Formats tab. GDAL does support many more formats and you can enable support for these by editing the preferences file directly. You will find this file in –

C:\Users\<username>\AppData\Roaming\MapInfo\Raster\XXX\ MIRasterPreferences.xml

To support a format, in the GDL driver section add a line like this (for GIF).

<format desc=”Graphics Interchange Format (.gif)” ext=”gif” GDALCode=”GIF” ProcessingEnabled=”true” RenderEnabled=”true”/>

See this page for the list of supported formats –

https://gdal.org/drivers/raster/index.html

In general, if the driver is “Built-in by default” then you ought to be able to use it in MapInfo Pro. For any format, you will require the extension list and the driver’s short name.

On the Raster ribbon, there are two key settings. The Raster Quality setting tells the raster engine what interpolation method to use when it prepares underviews. Underviews are used when zooming in. You can choose from Nearest Neighbour, Bilinear, and two Bicubic options. It also allows you to turn this entire capability off by selecting None. In this scenario, the raster image is rendered at base resolution and then image minification or magnification is used to zoom the raster. In this case, the Map Image Smoothing option is available and gives you control over the image processing quality.

The raster engine supports a variety of virtual raster formats. A virtual raster is a description of a raster, usually drawing on other real rasters. The raster engine generates the virtual raster data in real-time and on-demand, according to the supplied instructions.

MapInfo has invented its own virtual raster format, identified by an MVR extension. The file contains XML commands that tell the engine how to construct the virtual raster. GDAL also has a virtual raster implementation, identified by a VRT extension. VRT files are supported via the GDAL driver if they are enabled in the preferences.

MapInfo has also invented a second kind of virtual raster, identified by the MRD extension. This is a rendering algorithm. When you load an MRD raster, a rendering engine is invoked in real-time to render the algorithm on demand. The virtual raster is simply an image field, but the rendering algorithm may draw on many different rasters. This rendering engine is substantially superior to the rendering capability in the raster handler and was designed to replace it. Perhaps, one day, it will. In the meantime, you can access this advanced rendering engine via an MRD file.

MVR can be used to overcome some of the existing capability gaps in the raster handler rendering. For example, if you want to drape a multispectral RGB layer on a terrain hill shading, you can do this by combining all the rasters you need into a multi-banded virtual raster. You do not need to worry about cell size or coordinate systems, virtual rasters take care of all the processing.

MVR and VRT can be used as an alternative to many of the processing operations in MapInfo Pro Advanced. The advantage of using an MVR is that you will be able to see the result immediately and you will not have to run a potentially lengthy processing operation. For huge rasters source rasters, you can also save huge amounts of disk space. Of course, there are also disadvantages to be weighed up.