GRDINT

Vector grid interpolation


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm :: References :: Related

Back to top

Description


GRDINT fills in (grids) the raster image layer by interpolating image data between encoded vector data normally created by GRDVEC. GRDVEC and GRDINT can be used to create digital elevation models (DEM).
Back to top

Parameters


Name Type Caption Length Value range
FILE* String Input file name 1 - 192  
DBIC* Integer Input raster channel or layer 1 - 1  
DBOC* Integer Output raster channel or layer 1 - 1  
BACKVAL* Float Background gray-level value 1 - 1  
INTMETH String Interpolation method 0 - 6 CONIC | DIAG | SMOOTH
Default: DIAG

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the PCIDSK file that contains the input and output image channels.

DBIC

Specifies the input channel storing 4-connected encoded vectors. Normally, the input layer is encoded by running GRDVEC. The input channel may be of any data type.

DBOC

Specifies the output channel in which to store the interpolated raster image. The output channel may be of any data type.

BACKVAL

Specifies the background value for the input image.

All input pixels NOT set to the background value are assumed to be encoded lines, entered by the GRDVEC function or by other means. Values are interpolated for all input pixels having the background value. BACKVAL must be of the same data type as the input channel. By default, BACKVAL is set to zero.

INTMETH

Specifies which variation of the MDIP algorithm to use for interpolation.

Supported values include:

For more detailed information about these values, see the Algorithm section.

Note: The conic search method produces the best results, but may be up to 15 times slower than the other methods.
Back to top

Details

GRDINT (preceded by GRDVEC) is used to grid vector data. Gridding is the process of creating a raster image grid, given vector (line and point) data. GRDINT can interpolate (fill in) elevation data between contour lines that have been encoded into an image channel by GRDVEC. GRDVEC and GRDINT can be used to create digital elevation models (DEM).

GRDINT interpolates pixel values from an input image channel (DBIC), and saves results to an output image channel (DBOC). An interpolated value is calculated for each input pixel value that is not set to the background value (BACKVAL).

The user may choose one of three different algorithms for performing grid interpolation: diagonal search, smoothed diagonal search, or conic search; these are described in more detail in the Algorithm section.

GRDINT may be very slow for large files, especially with files containing large empty spaces, because searches are made out from each pixel of the background value until a value other than the background value is found. Completely empty images will take the most time to process.

Back to top

Examples

The Example section of the GRDVEC documentation provides a description of how to create an elevation image (DEM) from scratch, given a topographic map with elevation contours. Normally, VECDIG, CLR, GEOSET, and GRDVEC must be run prior to running GRDINT, and a filtering function (FME or FAV) should be run on the output image from GRDINT.

GRDINT can be used to interpolate data, regardless of its source. For example, suppose we have the following 16 by 16 image, stored in a text file, gridtest.txt:

   0   0   0   0   0   0   0   0   0   0   0   0  30   0   0   0
   0   0   0   0   0   0   0   0   0   0   0   0  30   0  20  20
   0   0  20  20  20   0   0  30  30  30   0   0  30   0  20   0
   0  20  20   0  20  20   0  30   0  30  30   0  30   0  20   0
  20  20   0   0   0  20   0  30   0   0  30  30  30  30  20  20
  20   0  10  10  10  20  30  30  40  40  40  30   0  30   0  20
  20   0  10   0  10  20  30   0  40   0  40  30   0  30   0  20
  20  20  10   0  10  20  30  30  40  40  40  30   0  30   0  20
   0  20  10  10  10  20   0  30   0   0  30  30   0  30   0  20
   0  20  20   0  20  20   0  30  30  30  30   0   0  30   0   0
   0   0  20  20  20   0   0   0   0   0   0   0   0  30   0   0
   0   0   0   0   0   0   0   0   0   0   0   0   0  30   0   0
   0   0   0   0   0   0   0   0   0   0   0   0   0  30  30  30
  30  30  30  30   0   0   0   0   0   0   0   0   0   0   0   0
   0   0   0  30  30  30  30   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0  30   0   0   0   0   0   0   0   0   0

Create a 16 by 16 database file with two 8-bit channels, then run NUMREAD to read the text file and store 8-bit data in the first image channel.

EASI>FILE = "grdtest.pix"    ! File name
EASI>TEX1 =                        
EASI>TEX2 = 
EASI>DBSZ = 16,16            ! 16 pixels by 16 lines
EASI>PXSZ = 30,30           ! 30x30-meter resolution
EASI>DBNC = 2,0,0,0          ! 2 8-bit channels
EASI>DBLAYOUT = "PIXEL"      ! Pixel interleaving

EASI>RUN CIM

EASI>TFILE = "gridtest.txt"
EASI>NUMFORM = "DATA"
EASI>DBOC = 1
EASI>MEMSIZE =
EASI>DBOW = 

EASI>RUN NUMREAD

Perform grid interpolation of the image channel, and print the results using the NUM function. This example uses the diagonal search method.

EASI>FILE = "irvine.pix"
EASI>DBIC = 1
EASI>DBOC = 2
EASI>BACKVAL = 0         ! Background value 0
EASI>INTMETH = "DIAG"    ! Diagonal Search Algorithm

EASI>RUN GRDINT

EASI>FILE = "irvine.pix"
EASI>DBIC = 2
EASI>DBIW = 0,0,16,16    ! print window 0,0,16,16 

EASI>RUN NUM
 NUM     Database Image Numeric Window 
 
 grid.pix                      [S    5PIC      16P      16L]  
 2 [ 8U] GRDINT  Interpolated grid image:  DBIC=  1, INTMETH=DIAG  

 Offset: (       0,       0)  Size: (      16,      16)

                                          1   1   1   1   1   1   1
      1   2   3   4   5   6   7   8   9   0   1   2   3   4   5   6
   +---------------------------------------------------------------
  1| 20  20  20  22  22  23  24  25  24  27  28  29  26  25  24  22
  2| 20  21  22  21  24  25  26  27  27  26  27  28  30  25  20  20
  3| 20  20  20  20  20  23  23  30  30  30  27  28  30  25  20  20
  4| 20  20  20  20  20  20  25  30  33  30  30  28  30  25  20  20
  5| 20  20  15  15  15  20  25  30  35  35  30  30  30  30  20  20
  6| 20  15  10  10  10  20  30  30  40  40  40  30  30  30  25  20
  7| 20  15  10  10  10  20  30  35  40  40  40  30  30  30  25  20
  8| 20  20  10  10  10  20  30  30  40  40  40  30  30  30  25  20
  9| 20  20  10  10  10  20  25  30  35  35  30  30  30  30  25  20
 10| 20  20  20  15  20  20  25  30  30  30  30  30  30  30  25  26
 11| 21  22  20  20  20  26  26  27  27  28  28  29  29  30  28  27
 12| 25  24  23  23  27  27  27  28  28  28  29  29  29  30  28  28
 13| 27  26  26  25  25  28  28  29  29  29  29  29  29  30  30  30
 14| 30  30  30  30  27  27  29  29  29  29  29  29  29  29  29  29
 15| 30  29  29  30  30  30  30  29  29  29  29  29  29  29  29  29
 16| 30  29  29  29  29  29  30  29  29  29  29  29  29  29  29  29
Back to top

Algorithm

GRDINT uses the MDIP (Morphology-Dependent Interpolation Procedure) algorithm to calculate the gray-level value of each background (unencoded) pixel in the input image. Encoded vector data values in the input image are not changed.

The algorithm is described on pages 582-586 in the following paper:

Carrara, Alberto. "Drainage and Divide Networks Derived from High-fidelity Digital Terrain Models". Proceedings of the NATO Advanced Study Institute on Statistical Treatments for Estimation of Mineral and Energy Resources, II Ciocco (Lucca), Italy, June 22-July 4, 1986. D. Reidel Publishing Company, Dordrecht, Holland (1988). pp. 581-597.

In short, the input image around each pixel with the background value is searched in 8 directions (up, down, left, right, and four diagonals) for the location of the two nearest encoded contour lines. Each pixel is classified morphologically as residing on a slope, a depression, or a peak. The interpolation algorithm depends on this classification. The algorithm requires that contour lines be encoded into the input image using 4-connected lines, (lines are all connected by pixels in four directions, up, down, left, and right, but not along diagonals). If lines are 8-connected rather than 4-connected, the algorithm might "miss" a contour line when searching in the diagonal directions.

In order to reduce the number and severity of artifacts produced by this algorithm, GRDINT operates using one of three selectable variations on the algorithm. These are:
Back to top

References

Carrara, Alberto. "Drainage and Divide Networks Derived from High-fidelity Digital Terrain Models". Proceedings of the NATO Advanced Study Institute on Statistical Treatments for Estimation of Mineral and Energy Resources, II Ciocco (Lucca), Italy, June 22-July 4, 1986. D. Reidel Publishing Company, Dordrecht, Holland (1988). pp. 581-597.

© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.