Grid creation – Pitney Bowes MapXtreme User Manual

Page 320

Advertising
background image

Chapter 17: Working with Rasters and Grids

Grid Creation

MapXtreme v7.1

327

Developer Guide

This example shows how to open and read cell values from a grid file.

VB example:

Public Shared Sub MapInfo_Raster_GridReadStartRead(ByVal _
gridread As GridRead, ByVal strGridFilename As String)

Dim strHillshadeFilename As String = _

gridread.DefaultHillshadeFilename(strGridFilename)

If gridread.StartRead() Then

Dim x As Integer = 0 ' TODO - set to a pixel column value
Dim y As Integer = 0 ' TODO - set to a pixel row value
Dim bIsNull As Boolean
Dim dValue As Double
If gridread.GetValue(x, y, bIsNull, dValue) Then

If bIsNull Then

' read a null cell
Console.Write("{0,20}", "NULL")

Else

' read a non-null cell, with value == dValue
Console.Write("{0,20}", dValue)

End If

End If
gridread.EndRead()

End If

End Sub

Grid Creation

MapXtreme provides the ability to create continuous grids using a writable grid handler and
interpolators. These grids are created programmatically using the
MapInfo.Raster.GridCreatorFromFeatures class, the Mig.ghl grid handler and one of two supplied
interpolators. Grids can be created from tables of data points or from selections.

Grids produced in MapXtreme are compatible with MapInfo Professional v 10.0.

A continuous grid is a map that is divided into a rectangular grid of cells, where each cell contains a
data value representing either a measured data point, or an interpolated value based on the
surrounding data points. The continuous grid displays the changing data values using a continuous
gradation of color across the map.

Previously MapXtreme was limited to reading a grid and getting back a list of its grid cell values. It
also could read information about a grid, such as hillshading and styles. The ContinuousGridWrite
class was available, but lacked the ability to use an interpolator which would have created grids that
better reflect its data points.

The MapInfo.Raster.GridCreatorFromFeatures is the main class to be called when creating a
continuous grid. It uses the MapInfo writable grid handler and an interpolator to produce the
continuous grid map.

Advertising