diff --git a/autotest/gdrivers/data/MRR/10X10X200_Bit4.mrr b/autotest/gdrivers/data/MRR/10X10X200_Bit4.mrr
new file mode 100644
index 000000000000..8229d5c03e8f
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_Bit4.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_RealDouble.mrr b/autotest/gdrivers/data/MRR/10X10X200_RealDouble.mrr
new file mode 100644
index 000000000000..9908adb6d790
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_RealDouble.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_RealSingle.mrr b/autotest/gdrivers/data/MRR/10X10X200_RealSingle.mrr
new file mode 100644
index 000000000000..837d21ff595e
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_RealSingle.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_SignedInt16.mrr b/autotest/gdrivers/data/MRR/10X10X200_SignedInt16.mrr
new file mode 100644
index 000000000000..ed29bcac4ae6
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_SignedInt16.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_SignedInt32.mrr b/autotest/gdrivers/data/MRR/10X10X200_SignedInt32.mrr
new file mode 100644
index 000000000000..a876a0e1cccd
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_SignedInt32.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_SignedInt64.mrr b/autotest/gdrivers/data/MRR/10X10X200_SignedInt64.mrr
new file mode 100644
index 000000000000..d3f5a3e68d8e
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_SignedInt64.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_SignedInt8.mrr b/autotest/gdrivers/data/MRR/10X10X200_SignedInt8.mrr
new file mode 100644
index 000000000000..d35c81d2e49a
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_SignedInt8.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt16.mrr b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt16.mrr
new file mode 100644
index 000000000000..7009ccb5dedd
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt16.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt32.mrr b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt32.mrr
new file mode 100644
index 000000000000..5769c64c2a0f
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt32.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt64.mrr b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt64.mrr
new file mode 100644
index 000000000000..6df0dffec92a
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt64.mrr differ
diff --git a/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt8.mrr b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt8.mrr
new file mode 100644
index 000000000000..5b222bbd445f
Binary files /dev/null and b/autotest/gdrivers/data/MRR/10X10X200_UnsignedInt8.mrr differ
diff --git a/autotest/gdrivers/data/MRR/Having65540Classes_English.mrr b/autotest/gdrivers/data/MRR/Having65540Classes_English.mrr
new file mode 100644
index 000000000000..8de87a569cae
Binary files /dev/null and b/autotest/gdrivers/data/MRR/Having65540Classes_English.mrr differ
diff --git a/autotest/gdrivers/data/MRR/LanSat8Bands.mrr b/autotest/gdrivers/data/MRR/LanSat8Bands.mrr
new file mode 100644
index 000000000000..06d43ce8a825
Binary files /dev/null and b/autotest/gdrivers/data/MRR/LanSat8Bands.mrr differ
diff --git a/autotest/gdrivers/data/MRR/RGBA_Imagery.mrr b/autotest/gdrivers/data/MRR/RGBA_Imagery.mrr
new file mode 100644
index 000000000000..3825efe9171c
Binary files /dev/null and b/autotest/gdrivers/data/MRR/RGBA_Imagery.mrr differ
diff --git a/autotest/gdrivers/data/MRR/RGBA_PaletteRaster.mrr b/autotest/gdrivers/data/MRR/RGBA_PaletteRaster.mrr
new file mode 100644
index 000000000000..c9c41be4ef1c
Binary files /dev/null and b/autotest/gdrivers/data/MRR/RGBA_PaletteRaster.mrr differ
diff --git a/autotest/gdrivers/data/MRR/RGB_Imagery.mrr b/autotest/gdrivers/data/MRR/RGB_Imagery.mrr
new file mode 100644
index 000000000000..cf89ee335df6
Binary files /dev/null and b/autotest/gdrivers/data/MRR/RGB_Imagery.mrr differ
diff --git a/autotest/gdrivers/data/MRR/SeattleElevation.mrr b/autotest/gdrivers/data/MRR/SeattleElevation.mrr
new file mode 100644
index 000000000000..98eb226d2b50
Binary files /dev/null and b/autotest/gdrivers/data/MRR/SeattleElevation.mrr differ
diff --git a/autotest/gdrivers/mrr.py b/autotest/gdrivers/mrr.py
new file mode 100644
index 000000000000..1af719ff1b9c
--- /dev/null
+++ b/autotest/gdrivers/mrr.py
@@ -0,0 +1,471 @@
+#!/usr/bin/env pytest
+# -*- coding: utf-8 -*-
+###############################################################################
+# $Id$
+#
+# Project: GDAL/OGR Test Suite
+# Purpose: Test MRR format driver.
+# Author: Pitney Bowes Software
+#
+###############################################################################
+# Copyright (c) 2007, Pitney Bowes Software
+# Copyright (c) 2011-2013,
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+###############################################################################
+
+from osgeo import gdal
+from array import array
+
+import gdaltest
+import pytest
+
+
+
+###############################################################################
+# Perform simple read test.
+
+def test_mrr_1():
+
+ gdaltest.mrr_drv = gdal.GetDriverByName('MRR')
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ tst = gdaltest.GDALTest('MRR', 'MRR/10X10X200_RealDouble.mrr', 1, 37769)
+ tst.testOpen()
+
+
+###############################################################################
+# Confirm we can recognised the following band data types.
+# RealSingle = Float
+# RealDouble = double
+# SignedInt32 = Int32
+# UnsignedInt32 = UInt32
+# SignedInt16 = Int16
+# UnsignedInt16 = UInt16
+
+def test_mrr_2_DataType():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ ds = gdal.Open('data/MRR/10X10X200_RealSingle.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Float32, 'Failed to detect RealSingle data type.'
+ ds = gdal.Open('data/MRR/10X10X200_RealDouble.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Float64, 'Failed to detect RealDouble data type.'
+ ds = gdal.Open('data/MRR/10X10X200_SignedInt32.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Int32, 'Failed to detect SignedInt32 data type.'
+ ds = gdal.Open('data/MRR/10X10X200_UnsignedInt32.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_UInt32, 'Failed to detect UnsignedInt32 data type.'
+ ds = gdal.Open('data/MRR/10X10X200_SignedInt16.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Int16, 'Failed to detect SignedInt16 data type.'
+ ds = gdal.Open('data/MRR/10X10X200_UnsignedInt16.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_UInt16, 'Failed to detect UnsignedInt16 data type.'
+ ds = None
+
+
+###############################################################################
+# Confirm we can recognised following band data types with nearest compatible data types.
+# Bit4 = Byte
+# signedInt8 = Int16
+# UnsignedInt8 = Byte
+
+def test_mrr_3_CompatibleDataType():
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+ ds = gdal.Open('data/MRR/10X10X200_Bit4.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Byte, 'Failed to detect Bit4 data type'
+ ds = gdal.Open('data/MRR/10X10X200_SignedInt8.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Int16, 'Failed to map to SignedInt16 data type'
+ ds = gdal.Open('data/MRR/10X10X200_UnsignedInt8.mrr')
+ dataType = ds.GetRasterBand(1).DataType
+ assert dataType == gdal.GDT_Byte, 'Failed to map to UnsignedInt16 data type'
+ ds = None
+
+
+###############################################################################
+# Verify MRR driver info
+
+def test_mrr_4_DriverInfo():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ tst = gdaltest.GDALTest('MRR', 'MRR/SeattleElevation.mrr', 1, None)
+ tst.testDriver()
+
+ dataset = gdal.Open('data/MRR/SeattleElevation.mrr', gdal.GA_ReadOnly)
+ assert 'MRR' == dataset.GetDriver().ShortName, 'Driver short name mismatched.'
+ assert 'MapInfo Multi Resolution Raster' == dataset.GetDriver().LongName, 'Driver full name mismatched.'
+ dataset = None
+
+
+###############################################################################
+# Verify MRR width and Height
+
+def test_mrr_5_RasterSize():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ dataset = gdal.Open('data/MRR/SeattleElevation.mrr', gdal.GA_ReadOnly)
+ assert 1024 == dataset.RasterXSize, 'Raster width mismatched.'
+ assert 1024 == dataset.RasterYSize, 'Raster height mismatched.'
+ dataset = None
+
+
+###############################################################################
+# Verify Imagery MRR's band count and Block size
+
+def test_mrr_6_ImageBandCount():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ dataset = gdal.Open('data/MRR/RGB_Imagery.mrr', gdal.GA_ReadOnly)
+ assert 3 == dataset.RasterCount, 'Raster band count mismatched.'
+
+ # Ensure that block size is not 0.
+ blockSize = dataset.GetRasterBand(1).GetBlockSize()
+ assert 0< blockSize[0]
+ assert 0< blockSize[1]
+
+ dataset = None
+
+
+###############################################################################
+# Verify Classified MRR's band count
+
+def test_mrr_7_ClassifedBandCount():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ dataset = gdal.Open('data/MRR/Having65540Classes_English.mrr', gdal.GA_ReadOnly)
+ assert 1 == dataset.RasterCount, 'Raster band count mismatched.'
+ dataset = None
+
+
+###############################################################################
+# Verify MRR Origin
+
+def test_mrr_8_Origin():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ dataset = gdal.Open('data/MRR/SeattleElevation.mrr', gdal.GA_ReadOnly)
+ geotransform = dataset.GetGeoTransform()
+ assert 444500.0 == geotransform[0], 'Raster OriginX mismatched.'
+ assert 5350500.0 == geotransform[3], 'Raster OriginY mismatched.'
+ dataset = None
+
+###############################################################################
+# Verify MRR cellsize
+
+def test_mrr_9_CellSize():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ dataset = gdal.Open('data/MRR/SeattleElevation.mrr', gdal.GA_ReadOnly)
+ geotransform = dataset.GetGeoTransform()
+ assert 200 == geotransform[1], 'Raster pixelSizeX mismatched.'
+ assert -200 == geotransform[5], 'Raster pixelSizeY mismatched.'
+
+ # Ensure that block size is not 0.
+ blockSize = dataset.GetRasterBand(1).GetBlockSize()
+ assert 0< blockSize[0]
+ assert 0< blockSize[1]
+
+ dataset = None
+
+
+###############################################################################
+# Verify MRR projection info
+
+def test_mrr_10_Projection():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ tst = gdaltest.GDALTest('MRR', 'MRR/SeattleElevation.mrr', 1, None)
+
+ gt = (444500.0, 200.0, 0.0, 5350500.0, 0.0, -200.0)
+
+ prj = """PROJCS["unnamed",
+ GEOGCS["unnamed",
+ DATUM["North_American_Datum_1983",
+ SPHEROID["GRS 80",6378137,298.257222101],
+ TOWGS84[0,0,0,0,0,0,0],
+ AUTHORITY["EPSG","6269"]],
+ PRIMEM["Greenwich",0],
+ UNIT["degree",0.0174532925199433],
+ AUTHORITY["EPSG","9122"]],
+ PROJECTION["Transverse_Mercator"],
+ PARAMETER["latitude_of_origin",0],
+ PARAMETER["central_meridian",-123],
+ PARAMETER["scale_factor",0.9996],
+ PARAMETER["false_easting",500000],
+ PARAMETER["false_northing",0],
+ UNIT["metre",1,
+ AUTHORITY["EPSG","9001"]],
+ AXIS["Easting",EAST],
+ AXIS["Northing",NORTH]]]"""
+
+ tst.testOpen(check_gt=gt,
+ check_stat=(0.005, 4370.262, 483.008, 517.523),
+ check_approx_stat=(0.00549332052469254, 4370.26220703125, 483.008622016405, 517.523079384345))
+
+ ds = gdal.Open('data/MRR/SeattleElevation.mrr',gdal.GA_ReadOnly)
+ got_prj = ds.GetProjectionRef()
+ ds = None
+
+ if prj.find('North_American_Datum_1983') == -1 or \
+ prj.find('Transverse_Mercator') == -1:
+ print(got_prj)
+ pytest.fail('did not get expected projection')
+
+ if got_prj != prj:
+ print('Warning: did not get exactly expected projection. Got %s' % got_prj)
+
+
+###############################################################################
+# Verify MRR Statistics
+
+def test_mrr_11_Statistics():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ tst = gdaltest.GDALTest('MRR', 'MRR/SeattleElevation.mrr', 1, None)
+
+ gt = (444500.0, 200.0, 0.0, 5350500.0, 0.0, -200.0)
+
+ tst.testOpen(check_gt=gt,
+ check_stat=(0.005, 4370.262, 483.008, 517.523),
+ check_approx_stat=(0.00549332052469254, 4370.26220703125, 483.008622016405, 517.523079384345))
+
+
+###############################################################################
+# Read subwindow. Tests the tail recursion problem.
+
+def test_mrr_12_BlockRead():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ tst = gdaltest.GDALTest('MRR', 'MRR/SeattleElevation.mrr', 1, 214,
+ 5, 5, 5, 5)
+ return tst.testOpen()
+
+
+###############################################################################
+# Verify the followings for imagery MRR
+# Band Count
+# Each band's checksum
+# Each band's statistics
+# Each band' overview count
+
+def test_mrr_13_ChecksumImagery():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ arrChecksum = array('i', [4955, 9496, 60874, 8232])
+ arrStats = [[24.00, 234.00, 129.58, 58.00],
+ [1.00, 253.00, 119.44, 78.74],
+ [0.00, 254.00, 130.78, 73.45],
+ [3.00, 253.00, 150.14, 65.81]]
+
+ overviewCount = 9
+
+ dataset = gdal.Open('data/MRR/RGBA_Imagery.mrr',gdal.GA_ReadOnly)
+ bands = dataset.RasterCount
+ assert len(arrChecksum) == bands, "Band count mismatched."
+
+ for i in range(bands):
+ band = dataset.GetRasterBand(i+1)
+
+ checksum = band.Checksum(xoff=0, yoff=0, xsize=band.XSize, ysize=band.YSize)
+ print('Band['+str(i+1)+'] CHECKSUM :',checksum)
+ assert arrChecksum[i] == checksum, 'Band['+str(i+1)+'] checksum mismatched.'
+
+ stats = band.GetStatistics( True, True )
+ assert None != band.GetStatistics( True, True) , 'Getstatistics returns None'
+ print("[ STATS ]: = Minimum=%.3f, Maximum=%.3f, Mean=%.3f, StdDev=%.3f" % (stats[0], stats[1], stats[2], stats[3] ))
+ assert arrStats[i][0] == round(stats[0],2), 'Statistics:[Minumum] mismatched.'
+ assert arrStats[i][1] == round(stats[1],2), 'Statistics:[Maximum] mismatched.'
+ assert arrStats[i][2] == round(stats[2],2), 'Statistics:[Mean] mismatched.'
+ assert arrStats[i][3] == round(stats[3],2), 'Statistics:[StdDev] mismatched.'
+
+ overviews = band.GetOverviewCount()
+ print("Band has {} overviews".format(overviews))
+ assert overviewCount == overviews, "Overview count mismatched."
+
+
+###############################################################################
+# Verify the followings for Continuous MRR
+# Band Count
+# Each band's checksum
+# Each band's statistics
+# Each band' overview count
+
+
+def test_mrr_14_ChecksumContinious():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ arrChecksum = array('i', [28606, 40719, 38697, 32088, 24241, 19614, 30134, 35043, 36269, 30763, 27037, 27765])
+ arrStats = [[9000.00, 26922.00, 12720.07, 2357.53],
+ [8254.00, 28338.00, 12254.44, 2579.38],
+ [7007.00, 28387.00, 11114.22, 2671.23],
+ [6475.00, 30879.00, 11043.36, 3018.66],
+ [6070.00, 34429.00, 11602.18, 3573.27],
+ [5592.00, 28048.00, 10389.53, 3113.41],
+ [5507.00, 25004.00, 9747.69, 2752.26],
+ [6813.00, 29738.00, 11081.63, 2799.42],
+ [5194.00, 14671.00, 5896.82, 462.21],
+ [7597.00, 20317.00, 16433.41, 1454.45],
+ [7918.00, 18255.00, 15091.32, 1171.29],
+ [20480.00, 61440.00, 54963.20, 12495.90]]
+ overviewCount = 10
+
+
+ dataset = gdal.Open('data/MRR/LanSat8Bands.mrr',gdal.GA_ReadOnly)
+ bands = dataset.RasterCount
+ assert len(arrChecksum) == bands, "Band count mismatched."
+
+ for i in range(bands):
+ band = dataset.GetRasterBand(i+1)
+
+ checksum = band.Checksum(xoff=0, yoff=0, xsize=band.XSize, ysize=band.YSize)
+ print('Band['+str(i+1)+'] CHECKSUM :',checksum)
+ assert arrChecksum[i] == checksum, 'Band['+str(i+1)+'] checksum mismatched.'
+
+ stats = band.GetStatistics( True, True )
+ assert None != band.GetStatistics( True, True) , 'Getstatistics returns None'
+ print("[ STATS ]: = Minimum=%.3f, Maximum=%.3f, Mean=%.3f, StdDev=%.3f" % (stats[0], stats[1], stats[2], stats[3] ))
+ assert arrStats[i][0] == round(stats[0],2), 'Statistics:[Minumum] mismatched.'
+ assert arrStats[i][1] == round(stats[1],2), 'Statistics:[Maximum] mismatched.'
+ assert arrStats[i][2] == round(stats[2],2), 'Statistics:[Mean] mismatched.'
+ assert arrStats[i][3] == round(stats[3],2), 'Statistics:[StdDev] mismatched.'
+
+ overviews = band.GetOverviewCount()
+ print("Band has {} overviews".format(overviews))
+ assert overviewCount == overviews, "Overview count mismatched."
+
+
+###############################################################################
+# Verify the followings for Classified MRR
+# Band Count
+# Band checksum
+# Band statistics
+# Band overview count
+# ClassTable Record count
+
+def test_mrr_15_ChecksumClassified():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ expchecksum = 31466
+ arrStats = [0.00, 65539.00, 29071.89, 20005.27]
+ colorTableRecordCount = 65540
+ overviewCount = 9
+
+ dataset = gdal.Open('data/MRR/Having65540Classes_English.mrr',gdal.GA_ReadOnly)
+ bands = dataset.RasterCount
+ assert 1 == bands, "Band count mismatched."
+
+ band = dataset.GetRasterBand(1)
+ checksum = band.Checksum(xoff=0, yoff=0, xsize=band.XSize, ysize=band.YSize)
+ print('Band[1] CHECKSUM :',checksum)
+ assert expchecksum == checksum, 'Band[1] checksum mismatched.'
+
+ stats = band.GetStatistics( True, True )
+ assert None != stats , 'Getstatistics returns None'
+ print("[ STATS ]: = Minimum=%.3f, Maximum=%.3f, Mean=%.3f, StdDev=%.3f" % (stats[0], stats[1], stats[2], stats[3] ))
+ assert arrStats[0] == round(stats[0],2), 'Statistics:[Minumum] mismatched.'
+ assert arrStats[1] == round(stats[1],2), 'Statistics:[Maximum] mismatched.'
+ assert arrStats[2] == round(stats[2],2), 'Statistics:[Mean] mismatched.'
+ assert arrStats[3] == round(stats[3],2), 'Statistics:[StdDev] mismatched.'
+
+ overviews = band.GetOverviewCount()
+ print("Band has {} overviews".format(overviews))
+ assert overviewCount == overviews, "Overview count mismatched."
+
+ colorTable = band.GetRasterColorTable()
+ assert None != colorTable , 'Band do not have color table. GetRasterColorTable returns None'
+ print("Band has a color table with {} entries".format(colorTable.GetCount()))
+ assert colorTableRecordCount == colorTable.GetCount(), "Band color table record count mismatched."
+
+
+###############################################################################
+# Verify the followings for ImagePalette MRR
+# Band Count
+# Band checksum
+# Band statistics
+# Band overview count
+# ClassTable Record count
+
+def test_mrr_16_ChecksumImagePalette():
+
+ if gdaltest.mrr_drv is None:
+ pytest.skip()
+
+ expchecksum = 997
+ arrStats = [1.00, 10.00, 5.40, 3.11]
+ overviewCount = 8
+ colorTableRecordCount = 11
+
+ dataset = gdal.Open('data/MRR/RGBA_PaletteRaster.mrr',gdal.GA_ReadOnly)
+ bands = dataset.RasterCount
+ assert 1 == bands, "Band count mismatched."
+
+ band = dataset.GetRasterBand(1)
+ checksum = band.Checksum(xoff=0, yoff=0, xsize=band.XSize, ysize=band.YSize)
+ print('Band[1] CHECKSUM :',checksum)
+ assert expchecksum == checksum, 'Band[1] checksum mismatched.'
+
+ stats = band.GetStatistics( True, True )
+ assert None != stats , 'Getstatistics returns None'
+ print("[ STATS ]: = Minimum=%.3f, Maximum=%.3f, Mean=%.3f, StdDev=%.3f" % (stats[0], stats[1], stats[2], stats[3] ))
+ assert arrStats[0] == round(stats[0],2), 'Statistics:[Minumum] mismatched.'
+ assert arrStats[1] == round(stats[1],2), 'Statistics:[Maximum] mismatched.'
+ assert arrStats[2] == round(stats[2],2), 'Statistics:[Mean] mismatched.'
+ assert arrStats[3] == round(stats[3],2), 'Statistics:[StdDev] mismatched.'
+
+ overviews = band.GetOverviewCount()
+ print("Band has {} overviews".format(overviews))
+ assert overviewCount == overviews, "Overview count mismatched."
+
+ colorTable = band.GetRasterColorTable()
+ assert None != colorTable , 'Band do not have color table. GetRasterColorTable returns None'
+ print("Band has a color table with {} entries".format(colorTable.GetCount()))
+ assert colorTableRecordCount == colorTable.GetCount(), "Band color table record count mismatched."
\ No newline at end of file
diff --git a/gdal/bin/MIRasterPreferences.xml b/gdal/bin/MIRasterPreferences.xml
new file mode 100644
index 000000000000..dba8b2d99795
--- /dev/null
+++ b/gdal/bin/MIRasterPreferences.xml
@@ -0,0 +1,104 @@
+
+
+
+ 2
+ Pseudocolor.lut
+ ./ColorPalettes/
+ 0
+ 1
+
+ 45
+ 45
+ 50
+ 50
+ 50
+
+ 45
+ 45
+ 50
+
+
+ 2
+ 268435456
+ 512
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ./MIRaster.log
+ 10000000
+ 3
+ 4096
+ 3
+
+
+
+ 1024
+
+
+
+
+
+ 50
+ 3
+
+
+ 53
+ 3
+
+ -1
+
+
+
+ false
+
+
+ 1
+
+
diff --git a/gdal/data/LICENSE.TXT b/gdal/data/LICENSE.TXT
new file mode 100644
index 000000000000..11fa09921e34
--- /dev/null
+++ b/gdal/data/LICENSE.TXT
@@ -0,0 +1,379 @@
+
+GDAL/OGR Licensing
+==================
+
+This file attempts to include all licenses that apply within the GDAL/OGR
+source tree, in particular any that are supposed to be exposed to the end user
+for credit requirements for instance. The contents of this file can be
+displayed from GDAL commandline utilities using the --license commandline
+switch.
+
+
+GDAL/OGR General
+----------------
+
+In general GDAL/OGR is licensed under an MIT/X style license with the
+following terms:
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+gdal/frmts/gtiff/tif_float.c
+----------------------------
+
+Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
+Digital Ltd. LLC
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Industrial Light & Magic nor the names of
+its contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+gdal/frmts/hdf4/hdf-eos/*
+------------------------
+
+ Copyright (C) 1996 Hughes and Applied Research Corporation
+
+ Permission to use, modify, and distribute this software and its documentation
+ for any purpose without fee is hereby granted, provided that the above
+ copyright notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation.
+
+
+gdal/frmts/pcraster/libcsf
+--------------------------
+
+Copyright (c) 1997-2003, Utrecht University
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+* Neither the name of Utrecht University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+gdal/frmts/grib/degrib/*
+------------------------
+
+The degrib and g2clib source code are modified versions of code produced
+by NOAA NWS and are in the public domain subject to the following
+restrictions:
+
+http://www.weather.gov/im/softa.htm
+
+DISCLAIMER The United States Government makes no warranty, expressed or
+implied, as to the usefulness of the software and documentation for any
+purpose. The U.S. Government, its instrumentalities, officers, employees,
+and agents assumes no responsibility (1) for the use of the software and
+documentation listed below, or (2) to provide technical support to users.
+
+http://www.weather.gov/disclaimer.php
+
+ The information on government servers are in the public domain, unless
+specifically annotated otherwise, and may be used freely by the public so
+long as you do not 1) claim it is your own (e.g. by claiming copyright for
+NWS information -- see below), 2) use it in a manner that implies an
+endorsement or affiliation with NOAA/NWS, or 3) modify it in content and
+then present it as official government material. You also cannot present
+information of your own in a way that makes it appear to be official
+government information..
+
+ The user assumes the entire risk related to its use of this data. NWS is
+providing this data "as is," and NWS disclaims any and all warranties,
+whether express or implied, including (without limitation) any implied
+warranties of merchantability or fitness for a particular purpose. In no
+event will NWS be liable to you or to any third party for any direct,
+indirect, incidental, consequential, special or exemplary damages or lost
+profit resulting from any use or misuse of this data.
+
+ As required by 17 U.S.C. 403, third parties producing copyrighted works
+consisting predominantly of the material appearing in NWS Web pages must
+provide notice with such work(s) identifying the NWS material incorporated
+and stating that such material is not subject to copyright protection.
+
+port/cpl_minizip*
+-----------------
+
+This is version 2005-Feb-10 of the Info-ZIP copyright and license.
+The definitive version of this document should be available at
+ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely.
+
+
+Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+
+For the purposes of this copyright and license, "Info-ZIP" is defined as
+the following set of individuals:
+
+ Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
+ Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
+ Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
+ David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
+ Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
+ Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
+ Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
+ Rich Wales, Mike White
+
+This software is provided "as is," without warranty of any kind, express
+or implied. In no event shall Info-ZIP or its contributors be held liable
+for any direct, indirect, incidental, special or consequential damages
+arising out of the use of or inability to use this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ definition, disclaimer, and this list of conditions.
+
+ 2. Redistributions in binary form (compiled executables) must reproduce
+ the above copyright notice, definition, disclaimer, and this list of
+ conditions in documentation and/or other materials provided with the
+ distribution. The sole exception to this condition is redistribution
+ of a standard UnZipSFX binary (including SFXWiz) as part of a
+ self-extracting archive; that is permitted without inclusion of this
+ license, as long as the normal SFX banner has not been removed from
+ the binary or disabled.
+
+ 3. Altered versions--including, but not limited to, ports to new operating
+ systems, existing ports with new graphical interfaces, and dynamic,
+ shared, or static library versions--must be plainly marked as such
+ and must not be misrepresented as being the original source. Such
+ altered versions also must not be misrepresented as being Info-ZIP
+ releases--including, but not limited to, labeling of the altered
+ versions with the names "Info-ZIP" (or any variation thereof, including,
+ but not limited to, different capitalizations), "Pocket UnZip," "WiZ"
+ or "MacZip" without the explicit permission of Info-ZIP. Such altered
+ versions are further prohibited from misrepresentative use of the
+ Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s).
+
+ 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
+ "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
+ own source and binary releases.
+
+
+gdal/ogr/ogrsf_frmts/dxf/intronurbs.cpp
+---------------------------------------
+
+This code is derived from the code associated with the book "An Introduction
+to NURBS" by David F. Rogers. More information on the book and the code is
+available at:
+
+ http://www.nar-associates.com/nurbs/
+
+
+Copyright (c) 2009, David F. Rogers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the David F. Rogers nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+gdal/alg/thinplatespline.cpp
+----------------------------
+
+IEEE754 log() code derived from:
+@(#)e_log.c 1.3 95/01/18
+
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+
+gdal/alg/libqhull
+-----------------
+
+Only applies when GDAL is compiled with internal qhull support
+
+
+ Qhull, Copyright (c) 1993-2012
+
+ C.B. Barber
+ Arlington, MA
+
+ and
+
+ The National Science and Technology Research Center for
+ Computation and Visualization of Geometric Structures
+ (The Geometry Center)
+ University of Minnesota
+
+ email: qhull@qhull.org
+
+This software includes Qhull from C.B. Barber and The Geometry Center.
+Qhull is copyrighted as noted above. Qhull is free software and may
+be obtained via http from www.qhull.org. It may be freely copied, modified,
+and redistributed under the following conditions:
+
+1. All copyright notices must remain intact in all files.
+
+2. A copy of this text file must be distributed along with any copies
+ of Qhull that you redistribute; this includes copies that you have
+ modified, or copies of programs or other software products that
+ include Qhull.
+
+3. If you modify Qhull, you must include a notice giving the
+ name of the person performing the modification, the date of
+ modification, and the reason for such modification.
+
+4. When distributing modified versions of Qhull, or other software
+ products that include Qhull, you must provide notice that the original
+ source code may be obtained as noted above.
+
+5. There is no warranty or other guarantee of fitness for Qhull, it is
+ provided solely "as is". Bug reports or fixes may be sent to
+ qhull_bug@qhull.org; the authors may or may not act on them as
+ they desire.
+
+gdal/frmts/pdf/pdfdataset.cpp (method PDFiumRenderPageBitmap())
+---------------------------------------------------------------
+
+Copyright 2014 PDFium Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+gdal/frmts/mrf/* (apply when MRF driver included in build)
+---------------------------------------------------------------
+
+Copyright (c) 2002-2012, California Institute of Technology.
+All rights reserved. Based on Government Sponsored Research under contracts NAS7-1407 and/or NAS7-03001.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL),
+ the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+~~~~~~~~
+
+Copyright 2014-2015 Esri
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+
diff --git a/gdal/doc/source/drivers/raster/index.rst b/gdal/doc/source/drivers/raster/index.rst
index f682dc8472da..0d2fda543f88 100644
--- a/gdal/doc/source/drivers/raster/index.rst
+++ b/gdal/doc/source/drivers/raster/index.rst
@@ -125,6 +125,7 @@ Raster drivers
mff
mff2
mg4lidar
+ mrr
mrsid
msg
msgn
diff --git a/gdal/doc/source/drivers/raster/mrr.rst b/gdal/doc/source/drivers/raster/mrr.rst
new file mode 100644
index 000000000000..9bec586c05bf
--- /dev/null
+++ b/gdal/doc/source/drivers/raster/mrr.rst
@@ -0,0 +1,119 @@
+.. _Raster.MRR:
+
+MRR --- Multi Resolution Raster
+===============================
+
+.. shortname:: MRR
+
+This driver supports reading of MRR (Multiple Resolution Raster) file format developed by Precisely(MapInfo).
+This driver does not provide support for creating, writing or editing MRR files.
+
+Driver capabilities
+-------------------
+
+.. supports_georeferencing::
+
+.. ReadMRR=YES Read mrr.
+
+Contents
+--------
+
+#. `Overview of MRR Driver <#driver_overview>`__
+#. `Issues and Limitations <#issues>`__
+#. `Building GDAL <#building_gdal>`__
+
+
+--------------------------------
+
+.. _driver_overview:
+
+Overview of MRR (Multiple Resolution Raster) Driver:
+----------------------------------------------------
+
+MRR unifies the storage of all types of raster data such as imagery, spectral imagery, continuous gridded data and thematic data.
+MRR extends the concept of a multi-banded raster to a "four dimensional" raster which may contain –
+
+- One or more fields, each of which contain a particular type of raster data. A field may contain multi-banded continuous grid data,
+ multi-banded classified data, color imagery or color imagery utilizing a fixed size color palette.
+- One or more events, each of which contain an addition or modification to the field data at a specified time.
+ Events provide a time dimension in MRR.
+- One or more bands which contain data in one of many supported data types such as 1/2/4/8/16/32/64 bit integers and 32/64 bit floating point.
+ Some data types, like color or complex numbers, may contain multiple components. These are exposed as virtual bands.
+- A stack of overviews, referred to as resolutions levels. Level 0 contains the ‘base resolution’ raster data.
+ Levels 1 upward contain overviews within which the cell size doubles at each level.
+ Levels -1 downward contain underviews which are generated on demand by interpolation from the base level.
+- MRR is designed to enable the creation of very large and high resolution rasters and the SDK ensures that access to data at any resolution level is constant.
+ Raster data is stored in a sparse collection of tiles of equal size. Lossless compression codecs are employed to store data within each tile,
+ and lossy image compression codec can be used for imagery fields. Each resolution level has a fixed cell size,
+ but MRR supports a multi-resolution tile concept which allows the cell size to set in each tile separately.
+
+NOTE: Some MRR features may not be accessible through GDAL driver.
+
+The MRR driver for GDAL is supported on 64-bit Windows, Ubuntu, AmazonLinux, OracleLinux and CentOS.
+
+--------------
+
+.. _issues:
+
+Issues and Limitations
+----------------------
+
+- The driver does not provide support for creating, writing or editing MRR files.
+- Although an MRR may contain multiple fields, this driver can only access the first field.
+- Although an MRR may contain multiple events, this driver can only access data that represents the roll-up of all events.
+ This represents the "final state" of the raster.
+
+--------------
+
+.. _building_gdal:
+
+Building as Plugin driver:
+--------------------------
+
+
+To build MRR driver as plugin(autoload) driver.
+
+First build gdal a you woud build it normally.
+
+switch to ../gdal/frmts/mrr directory and issue following build commands based up on your platform.
+
+Windows:
+
+nmake /f makefile.vc plugin
+
+Linux:
+
+make plugin
+
+
+MapInfo Pro Advanced SDK Runtime
+--------------------------------
+
+MRR driver needs MapInfo Pro Advanced SDK to be installed on the machine to work with GDAL.
+
+Download MapInfo Pro Advanced SDK by navigating to "https://www.pitneybowes.com/us/campaign/sdkrequest.html"
+and fill up the SDK request form to receive the download link on your e-mail.
+Once the SDK package is downloaded, unzip the package on your machine at the desired location.
+
+SDK Zip folder Structure:
+-------------------------
+
+MapInfo Pro Advanced SDK zip file contains following folders:
+
+- AmazonLinux --> 64 bit Binaries for AmazonLinux.
+
+- CentOS7 --> 64 bit Binaries for CentOS7.
+
+- OracleLinux --> 64 bit Binaries for OracleLinux.
+
+- Ubuntu --> 64 bit Binaries for Ubuntu.
+
+- Windows --> 64 bit Binaries for Windows.
+
+
+Choose the binaries for the desired platform from the "Raster GDAL" folder and copy all files into the folder containing GDAL binaries.
+
+
+
+
+
diff --git a/gdal/frmts/gdalallregister.cpp b/gdal/frmts/gdalallregister.cpp
index 8a1597c1f3d7..90f87f0feb43 100644
--- a/gdal/frmts/gdalallregister.cpp
+++ b/gdal/frmts/gdalallregister.cpp
@@ -603,6 +603,10 @@ void CPL_STDCALL GDALAllRegister()
GDALRegister_STACTA();
#endif
+#ifdef FRMT_mrr
+ GDALRegister_MRR();
+#endif
+
// NOTE: you need to generally your own driver before that line.
/* -------------------------------------------------------------------- */
diff --git a/gdal/frmts/makefile.vc b/gdal/frmts/makefile.vc
index a7a94b7aaad8..8032eae83538 100644
--- a/gdal/frmts/makefile.vc
+++ b/gdal/frmts/makefile.vc
@@ -18,7 +18,7 @@ EXTRAFLAGS = -DFRMT_ceos -DFRMT_aigrid -DFRMT_elas -DFRMT_hfa -DFRMT_gtiff\
-DFRMT_safe -DFRMT_sentinel2 -DFRMT_derived -DFRMT_prf \
-DFRMT_sigdem -DFRMT_ignfheightasciigrid -DFRMT_tga -DFRMT_stacta
-MOREEXTRA =
+MOREEXTRA =
DIRLIST = $(EXTRAFLAGS:-DFRMT_=)
@@ -56,7 +56,7 @@ EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_openjpeg
!ENDIF
!IFDEF KAKDIR
-!IF "$(JP2KAK_PLUGIN)" != "YES"
+!IF "$(JP2KAK_PLUGIN)" != "YES"
EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_jp2kak -DFRMT_jpipkak
!ELSE
PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_jp2kak -DFRMT_jpipkak
@@ -71,6 +71,14 @@ PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_ecw
!ENDIF
!ENDIF
+!IFDEF MRR_ENABLED
+!IF "$(MRR_PLUGIN)" != "YES"
+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_mrr
+!ELSE
+PLUGINFLAGS = $(PLUGINFLAGS) -DFRMT_mrr
+!ENDIF
+!ENDIF
+
!IFDEF LURATECH_CFLAGS
!IF "$(JP2LURA_PLUGIN)" != "YES"
EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_jp2lura
diff --git a/gdal/frmts/mrr/APICodes.h b/gdal/frmts/mrr/APICodes.h
new file mode 100644
index 000000000000..6e532af5e35e
--- /dev/null
+++ b/gdal/frmts/mrr/APICodes.h
@@ -0,0 +1,1042 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+#pragma once
+
+//
+// Dictionary CUSRDSystem
+//
+// Do not manually edit this file. It should be re-generated, when required, by running MakeAPICodes.exe.
+// This program will also re-generate RasterDictionary.xml.
+//
+// New error codes should be added to m_vvDictionary in MINTSystem.cpp
+//
+
+#define MINT_SUCCESS 0 // The operation succeeded.
+#define MINT_NO_ERROR 1 // The operation reported no error.
+#define MINT_NO_RESULT 2 // The operation did not report a result.
+#define MINT_UNKNOWN_RESULT 3 // The operation reported an unknown result.
+#define MINT_UNKNOWN_FAILURE 4 // An unknown error has occurred.
+#define MINT_FAILURE 5 // The operation failed.
+#define MINT_NO_STATUS 6 //
+#define MINT_INVALID_ARG 7 // An invalid argument was supplied.
+#define MINT_NULL_ARG 8 // An invalid (null) argument was supplied.
+#define MINT_EXCEPTION 9 // An unexpected failure occurred.
+#define MINT_EXCEPTION_MSG 10 // An unexpected failure occurred: "%1!%r!".
+#define MINT_ALLOCATE_FAIL 11 // Failed to allocate memory.
+#define MINT_UNSUPPORTED_VERSION 12 // Version not supported.
+#define MINT_DLL_NOTLOADED 971 // The required DLL could not be loaded.
+#define MINT_FILEERROR_GENERAL 13 // An error occurred accessing the file: %1!%r!.
+#define MINT_FILEERROR_OPEN 14 // Failed to open file.
+#define MINT_FILEERROR_OPEN_NAME 15 // Failed to open file: %1!%r!.
+#define MINT_FILEERROR_OPEN_CAUSE 16 // Failed to open file: %1!%r!, cause %2!%r!.
+#define MINT_FILEERROR_CLOSE 17 // Failed to close file: %1!%r!, cause %2!%r!.
+#define MINT_FILEERROR_READ 18 // An error was encountered while reading the file: %1!%r!.
+#define MINT_FILEERROR_WRITE 19 // An error was encountered while writing the file: %1!%r!.
+#define MINT_FILEERROR_DELETE 20 // Failed to delete file: %1!%r!, cause %2!%r!.
+#define MINT_FILEERROR_SETLENGTH 21 // Failed to resize file: %1!%r!, cause %2!%r!.
+#define MINT_FILEERROR_NOTFOUND 22 // The file does not exist: %1!%r!.
+#define MINT_FILEERROR_BADPATH 23 // File path not found: %1!%r!.
+#define MINT_FILEERROR_EMPTYNAME 24 // The file name is empty.
+#define MINT_FILEERROR_TOOMANYOPEN 25 // There are too many open files in this system. Try closing some programs or rebooting the system.
+#define MINT_FILEERROR_ACCESSROOTDIR 26 // This is the root directory. You cannot use it as a file: %1!%r!.
+#define MINT_FILEERROR_ACCESSDIR 27 // This is a directory. You cannot use it as a file: %1!%r!.
+#define MINT_FILEERROR_ACCESSSYSTEM 28 // This is a special system file. You cannot access it: %1!%r!.
+#define MINT_FILEERROR_ACCESSRO 29 // You cannot write to a read-only file: %1!%r!.
+#define MINT_FILEERROR_INVALIDFILE 30 // An invalid file handle was used.
+#define MINT_FILEERROR_REMOVECURDIR 31 // An attempt was made to remove the current directory.
+#define MINT_FILEERROR_DIRFULL 32 // The file could not be created because the directory is full: %1!%r!.
+#define MINT_FILEERROR_BADSEEK 33 // A software error occurred: seek to bad file position.
+#define MINT_FILEERROR_HARDIO 34 // There was a hardware error. There may be a problem with your computer or disk drive.
+#define MINT_FILEERROR_HARDIO_REMOVE 35 // There was a problem accessing the drive. Please ensure that the medium is present.
+#define MINT_FILEERROR_HARDIO_REMOTE 36 // There was a problem accessing the file. There may be a problem with your network.
+#define MINT_FILEERROR_SHARING 37 // A file sharing violation occurred: %1!%r!.
+#define MINT_FILEERROR_LOCK 38 // A file lock violation occurred: %1!%r!.
+#define MINT_FILEERROR_DISKFULL 39 // The file could not be written as the disk is full.
+#define MINT_FILEERROR_EOF 40 // An attempt was made to access past the end of the file: %1!%r!.
+#define MINT_FILEERROR_RENAME 41 // Failed to rename file %1!%r!, cause %2!%r!.
+#define MINT_FILEERROR_BADEXT 42 // The file has an invalid extension.
+#define MINT_FILEERROR_NOSTREAM 43 // No file stream was supplied.
+#define MINT_FILEERROR_STREAM_NOTOPEN 44 // The file stream is not open.
+#define MINT_FAIL_CREATE_FILE 45 // Failed to create the file.
+#define MINT_CREATE_FILE 46 // Creating output file: %1!%r!.
+#define MINT_FILE_EXISTS 47 // The output file already exists.
+#define MINT_FILE_OPEN 48 // Opening file: %1!%r!.
+#define MINT_FILE_NO_DIR 49 // The folder does not exist : %1!%r.
+#define MIR_INTERP_NO_OUTPUT_FOLDER 50 // Output folder verification failure.
+#define MINT_FILE_NOFINDDIR 51 // A suitable folder could not be found.
+#define MINT_FILE_OVERWRITE 52 // Warning: Overwriting file %1!%r!.
+#define MIR_INTERP_OUTPUT_ALREADY_OPEN 53 // The output file is already open in another process.
+#define MIR_INTERP_VERIFY_ALREADY_OPEN 54 // The file is currently open for read or write by another process: %1!%r!.
+#define MIR_INTERP_VERIFY_CLOSE 55 // Close the file before proceeding: %1!%r!.
+#define MIR_INTERP_VERIFY_CLOSE2 56 // The output file %1!%r! exists and is currently open in another process. Please close the file (or modify the output raster file name) and restart interpolation.
+#define MIR_ERROR_CREATETEMPFILE 57 // Error: Failed to create temporary file.
+#define MIR_INTERP_VERIFY_INPUT_FAILURE 58 // Input file verification failure.
+#define MIR_INTERP_VERIFY_OUTPUT_FILENAME 59 // The output raster file name %1!%r! is invalid. The filename is blank.
+#define MIR_DELETED 60 // Deleted %1!%r!.
+#define MINT_XML_NODOC 61 // XML parsing error. No valid XML document found.
+#define MINT_XML_NOROOT 62 // XML parsing error. No root element found.
+#define MINT_XML_NOROOT_NAMED 63 // XML parsing error. No root element found. (expecting: %1!%r!).
+#define MINT_XML_BADELEMENT 64 // XML parse warning. Unrecognized element found.
+#define MINT_XML_BADELEMENT_NAMED 65 // XML parse warning. Unrecognized element "%1!%r!" found containing "%2!%r!".
+#define MINT_PARSE_UNKNOWNTOKEN 66 // Unknown token encountered whilst parsing: %1!%r!
+#define MINT_PROCESS_BEGIN 67 // Processing operation started.
+#define MINT_PROCESS_COMPLETE 68 // Processing operation complete.
+#define MINT_PROCESS_TERMINATED 69 // Processing operation terminated.
+#define MINT_PROCESS_FAILED 70 // Processing operation failed.
+#define MINT_PROCESS_PAUSED 71 // Process execution paused.
+#define MINT_PROCESS_RESUMED 72 // Process execution resumed.
+#define MINT_PROCESS_STOPPED 73 // Process execution stopped.
+#define MINT_PROCESS_STARTED 74 // Process execution restarted.
+#define MINT_PROCESS_WAITING 75 // Process waiting to resume.
+#define MINT_PROCESS_CANCELED 76 // Process execution canceled.
+#define MINT_OPERATION_PROGRESS 77 // Operation %1!%r!% complete.
+#define MINT_PROCESS_PROGRESS 78 // Process %1!%r!% complete.
+#define MINT_TRACKER_CREATE_FAIL 79 // Memory allocation failure. Could not create a process tracker object.
+#define MINT_ZIP_FAILINIT 80 // ZIP compression failed to initialize. %1!%r!
+#define MINT_ZIP_FAIL 81 // ZIP compression failed. %1!%r!
+#define MINT_ZIP_FAILEND 82 // ZIP Compression failed to end. %1!%r!
+#define MINT_LZMA_FAILMEMRETRY 83 // LZMA compression at level %1!%r! failed due to a failed memory allocation. Retrying.
+#define MINT_LZMA_FAILMEM 84 // LZMA compression failed due to a failed memory allocation.
+#define MINT_LZMA_FAILPARAM 85 // LZMA compression failed due to a parameter error.
+#define MINT_LZMA_FAILOVRRUNRETRY 86 // LZMA compression at level %1!%r! failed due to a buffer overrun. Retrying.
+#define MINT_LZMA_FAILOVRUN 87 // LZMA compression failed due to a buffer overrun.
+#define MINT_LZMA_FAILTHREADRETRY 88 // LZMA compression at level %1!%r! failed due to thread issue.
+#define MINT_LZMA_FAILTHREAD 89 // LZMA compression failed due to a thread issue.
+#define MINT_LZMA_FAIL 90 // LZMA compression failed. %1!%r!
+#define MINT_UNZIP_FAILINIT 91 // ZIP decompression failed to initialize. %1!%r!
+#define MINT_UNZIP_FAIL 92 // ZIP decompression failed. %1!%r!
+#define MINT_UNLZMA_FAIL 93 // LZMA decompression failed. %1!%r!
+#define MINT_INVALID_EXPRESSION 94 // Invalid expression.
+#define MINT_INVALID_EXPRESSION_SQUARE_BRACKETS 95 // Invalid expression: Invalid use of square brackets.
+#define MINT_INVALID_EXPRESSION_STATS_SINGLE_BAND_ONLY 96 // Invalid expression: The statistics functions cannot be applied to multiple bands.
+#define MINT_INTERP_READING 97 // Reading file: %1!%r!.
+#define MINT_INTERP_FILE_FAIL 98 // Failed to read file: %1!%r!.
+#define MINT_INTERP_ZIP_FIND_FAIL 99 // Failed to find file %1!%r! in ZIP file: %2!%r!.
+#define MIR_INTERP_ZIP_READ_FAIL 100 // Failed to read ZIP file: %1!%r!.
+#define MINT_COMPUTE_STATS1 101 // Compute histogram.
+#define MINT_COMPUTE_STATS2 102 // Compute basic univariate statistics.
+#define MINT_COMPUTE_STATS3 103 // Compute skewness statistics.
+#define MINT_COMPUTE_STATS4 104 // Compute basic bivariate statistics.
+#define MINT_COMPUTE_STATS5 105 // Compute correlation statistics.
+#define MINT_COMPUTE_STATS6 106 // Compute rank statistics.
+#define MINT_COMPUTE_STATS7 107 // Compute expectation statistics.
+#define MINT_COMPUTE_STATS8 108 // Compute basic multivariate statistics.
+#define MINT_COMPUTE_STATS9 109 // Compute first order surface fit.
+#define XCFS_NOTOPEN_MOD 110 // XCFS error: XCFS is not modifiable.
+#define XCFS_FLGS_INCOMPATIBLE 111 // XCFS error: Unable to re-open stream (supplied flags are incompatible).
+#define XCFS_MOD_NOTALLOWED 112 // XCFS error: Stream is not modifiable.
+#define XCFS_EX_ACCESS 113 // XCFS error: Stream is open for exclusive access.
+#define XCFS_ZERO_FILESIZE 114 // XCFS error: Unable to truncate stream.
+#define XCFS_ZERO_LEN 115 // XCFS error: File has zero length.
+#define XCFS_EST_FILELEN 116 // XCFS error: Unable to determine XCFS file length.
+#define XCFS_FAIL_OPEN 117 // XCFS error: Unable to open XCFS file.
+#define XCFS_FAIL_OPEN_STREAM 118 // XCFS error: Unable to open stream.
+#define XCFS_FAIL_CREATE_STREAM 119 // XCFS error: Unable to create stream.
+#define XCFS_FAIL_OPEN_MFT 120 // XCFS error: Unable to open file table system stream.
+#define XCFS_FAIL_OPEN_EMPTY_CLUSTER 121 // XCFS error: Unable to open empty cluster stream.
+#define XCFS_FAIL_OPEN_FILE_INDEX 122 // XCFS error: Unable to open file index server stream.
+#define XCFS_FAIL_READ_ROOT 123 // XCFS error: Unable to read root cluster.
+#define XCFS_FAIL_CLUSTERCHAIN 124 // XCFS error: Unable to read file cluster chain.
+#define XCFS_FAIL_CLOSE 125 // XCFS error: Unable to close XCFS file.
+#define XCFS_FAIL_COMMIT 126 // XCFS error: Unable to commit XCFS file.
+#define XCFS_FAIL_COMMIT_ROOT 127 // XCFS error: Unable to commit root.
+#define XCFS_FAIL_COMMIT_TABLE 128 // XCFS error: Unable to commit file table stream.
+#define XCFS_FAIL_COMMIT_FILE 129 // XCFS error: Unable to commit a file.
+#define XCFS_FAIL_COMMIT_FILE_INDEX 130 // XCFS error: Unable to commit file index server stream.
+#define XCFS_FAIL_COMMIT_EMPTY_CLUSTER 131 // XCFS error: Unable to commit empty cluster stream.
+#define XCFS_FAIL_CLOSUREFLAG 132 // XCFS error: Closure flag indicates the file failed to close properly. The file may be corrupt.
+#define XCFS_FAIL_VERSION 133 // XCFS error: File version is not supported.
+#define XCFS_FAIL_NOTXCFS 134 // XCFS error: File is not an XCFS file.
+#define XCFS_FAIL_STREAM_NOTOPEN 135 // XCFS error: The stream is not open.
+#define XCFS_FAIL_ARCHIVE_CORRUPT 136 // XCFS error: Archive sub-file is corrupt.
+#define XCFS_FAIL_COMPRESS 137 // XCFS error: Compression operation failed. File data is corrupt.
+#define XCFS_FAIL_DECOMPRESS 138 // XCFS error: Decompression operation failed. File data is corrupt.
+#define XCFS_INVALID_FILECOUNT 139 // XCFS error: Root file count does not match file server.
+#define XCFS_INVALID_CLUSTERCOUNT 140 // XCFS error: Root cluster count does not match file size.
+#define MIR_NOT_LICENSED 141 // MapInfo Advanced (Raster) is not licensed.
+#define MIR_INVALID_FIELD 142 // An invalid field index was referenced.
+#define MIR_INVALID_BAND 143 // An invalid band index was referenced.
+#define MIR_INVALID_EVENT 144 // An invalid event index was referenced.
+#define MIR_INVALID_LEVEL 145 // An invalid level index was referenced.
+#define MIR_FAIL_LOADSTRUCTURE 146 // Failed to load the raster structural data.
+#define MIR_INVALID_STRUCTURE 147 // Failed to validate the raster structural data.
+#define MIR_FAIL_CREATE 148 // Failed to create the raster.
+#define MIR_FAIL_COMMIT 149 // Failed to commit the raster to file.
+#define MIR_FAIL_NOZIPSUPPORT 150 // Unable to support ZIP file format.
+#define MIR_ZIPEDIT_NOT_ALLOWED 151 // The edit cell operation is not supported for rasters stored in a ZIP archive.
+#define MIR_RASTER_CLOSED 152 // Raster has been closed.
+#define MIR_INVALIDHANDLE 153 // An invalid handle has been provided.
+#define MIR_FAIL_INVALIDDRIVER 154 // An invalid driver was requested.
+#define MIR_INVALID_CONVERSION 155 // The requested raster conversion is not supported.
+#define MIR_BEGIN_ITER_FAILED 156 // Unable to start raster cell iterator.
+#define MIR_RGB_FIELD_NOT_FOUND 157 // RGB field not found.
+#define MIR_CLASSVAL_FIELD_NOT_FOUND 158 // Class value field not found in classification table.
+#define MIR_NO_TILE 159 // The raster contains no tiles.
+#define MIR_EDITCELL_NOT_ALLOWED 160 // The edit cell operation is not supported.
+#define MIR_CREATE_NOT_ALLOWED 161 // The create operation is not supported by this raster driver.
+#define MIR_ZIPCREATE_NOT_ALLOWED 162 // The create operation is not supported for rasters stored in a ZIP archive.
+#define MIR_NOT_IMPLEMENTED 163 // The requested feature is not yet implemented.
+#define MIR_READ_NOT_ALLOWED 164 // Raster is not readable.
+#define MIR_WRITE_NOT_ALLOWED 165 // Raster is not writable.
+#define MIR_EDIT_INVALID 166 // An edit operation has been attempted on a raster that is not editable.
+#define MIR_EDIT_FAILED 167 // An edit operation failed.
+#define MIR_FORWARD_VERSION 168 // The version of input raster is higher. Some features may not be loaded.
+#define MIR_ONLY_CONTINOUS_SUPPORTED 169 // The raster field type is invalid: only continuous field is supported.
+#define MIR_RASTER_SOURCE_FILE_CHANGE 964 // A driver has changed the raster source file name and restarted mounting.
+#define MIR_VD_EXTRA_FIELDS 170 // Too many fields - additional fields will be ignored.
+#define MIR_VD_NO_FIELDS 171 // No fields - raster is invalid.
+#define MIR_VD_EXTRA_BANDS 172 // Too many bands - additional bands will be ignored.
+#define MIR_VD_NO_BANDS 173 // No bands - raster is invalid.
+#define MIR_BAND_TYPE_NOTSUPPORTED 174 // Band type is not supported by the raster driver.
+#define MIR_VD_MADE_BASETILESIZE 175 // Base level tile size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_UNDERVIEWTILESIZE 176 // Underview tile size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_OVERVIEWTILESIZE 177 // Overview tile size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_BASEMAPSIZE 178 // Base level map size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_UNDERVIEWMAPSIZE 179 // Underview map size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_OVERVIEWMAPSIZE 180 // Overview map size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_CAPSTONEMAPSIZE 181 // Capstone map size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_MADE_GRIDSIZE 182 // Grid size was changed to (%1!%r!,%2!%r!).
+#define MIR_VD_EXCEEDSGRIDSIZE 183 // Grid size exceeds limit supported by the driver.
+#define MIR_VD_MADE_CELLSIZE 184 // Cell size was changed to (%1!%.10g!,%2!%.10g!).
+#define MIR_VD_BAD_COORDSYS 185 // Supplied coordinate system is invalid.
+#define MIR_VD_NO_TRANSFORM 186 // A default world-cell transformation has been adopted.
+#define MIR_VD_NO_ENDIAN 187 // Supplied endian mode is not supported by this driver
+#define MIR_VD_NO_CONTINUOUS 188 // Field type (continuous) is not supported by this driver.
+#define MIR_VD_NO_IMAGE 189 // Field type (image) is not supported by this driver.
+#define MIR_VD_NO_IMAGEPALETTE 190 // Field type (image palette) is not supported by this driver.
+#define MIR_VD_NO_CLASSIFIED 191 // Field type (classified) is not supported by this driver.
+#define MIR_VD_MADE_CONTINUOUS 192 // Field type was changed (to continuous).
+#define MIR_VD_MADE_IMAGE 193 // Field type was changed (to image).
+#define MIR_VD_MADE_IMAGEPALETTE 194 // Field type was changed (to image palette).
+#define MIR_VD_MADE_CLASSIFIED 195 // Field type was changed (to classified).
+#define MIR_VD_MADENO_COMRPESSION 196 // Compression was disabled.
+#define MIR_VD_MADE_COMRPESSION 197 // Compression was changed to %1!%r!.
+#define MIR_VD_MADE_COMRPESSION_LOSSLESS 198 // Invalid compression method. Reset to default lossless compression.
+#define MIR_VD_MADE_DATATYPE 199 // Band data type was changed to %1!%r!.
+#define MIR_VD_MADE_STORETYPE 200 // Band store data type was changed to %1!%r!.
+#define MIR_VD_MADE_STORETYPEEQUAL 201 // Band data type and storage data type were made to match.
+#define MIR_VD_BANDDATASTORENOTEQUAL 202 // Band data type and stored type differ, but no transform is in use. Is this the intention?
+#define MIR_VD_MADE_NULLTYPE 203 // Band null type was changed to %1!%r!.
+#define MIR_VD_MADE_NULLDATATYPE 204 // Band null data type was changed to %1!%r!.
+#define MIR_VD_MADE_NULLDATATYPEEQUAL 205 // Band null data type was changed to match the data type.
+#define MIR_VD_MADE_NULLVALUE 206 // Band null type was changed to %1!%.10g!.
+#define MIR_VD_NO_RESTRICTDECIMALS 207 // Band decimal restriction is not supported by this driver.
+#define MIR_VD_SET_TRANSFORM 208 // A band transform was defined.
+#define MIR_VD_BAD_TRANSFORM 209 // The supplied band transform was not honored.
+#define MIR_VD_NO_TRANSFORMSCALE 210 // The supplied band transform scale was not honored.
+#define MIR_VD_NO_TRANSFORMOFFSET 211 // The supplied band transform offset was not honored.
+#define MIR_VD_SET_CLIP 212 // A band clip range was defined.
+#define MIR_VD_NO_CLIPMIN 213 // The supplied band clip band clip minimum value was not honored.
+#define MIR_VD_NO_CLIPMAX 214 // The supplied band clip band clip maximum value was not honored.
+#define MIR_VD_NO_CLASSTABLE 215 // No classification table was supplied.
+#define MIR_VD_SET_PRIMARYCOLOR 216 // The color palette was assigned a primary color field.
+#define MIR_VD_NO_PRIMARYCOLOR 217 // The color palette does not contain a color field.
+#define MIR_VD_EXTRA_TABLE 218 // The supplied classification table was deleted as it is not supported by the field type.
+#define MIR_VD_NO_PREDENCODE 219 // The supplied predictive encoding settings were not honored.
+#define MIR_VD_NO_DISCRETE 220 // The discrete value setting is not supported by this driver.
+#define MIR_VD_NO_EVENT 221 // The raster driver does not support multiple events. Only the last event will be retained.
+#define MIR_ERROR_ITERATORBEGINFAIL 222 // Error: Failed to begin iterator.
+#define MIR_ERROR_ITERATORFAIL 223 // Error: Iterator failed.
+#define MIR_ERROR_ITERATORFAILWRITE 224 // Error: Iterator failed to write data.
+#define MIR_ERROR_NORASTERACCESS 225 // Error: Failed to acquire raster access.
+#define MIR_RASTER_INFO_UNAVAILABLE 226 // Raster information is not available.
+#define MIR_RASTERINFO_NOT_MATCHED 227 // Unable to match raster information.
+#define MIR_CONNECT_TO_EXISTING 228 // Connected to open raster.
+#define MIR_NO_CONCURRENT_ACCESS 229 // The raster is currently open. No concurrent access is allowed.
+#define MIR_FAIL_STATS 230 // Failed to compute the raster statistics.
+#define MIR_RASTER_CACHE_UNAVAILABLE 231 // Raster cache is unavailable.
+#define MIR_FAIL_CREATE_RASTER_CACHE 232 // Failed to create a raster cache.
+#define MIR_TOO_LARGE 233 // The raster exceeds the maximum number of rows or columns allowed by this driver.
+#define MIR_INTERP_DRIVER_CAPS 234 // Error: Raster driver capabilities were not retrieved.
+#define MIR_RASTER_CLASS_SIZE_TOO_LARGE 235 // Raster class table size is too large.
+#define MIR_FLUSHING_TILES_S 236 // Writing cached tiles to disk.
+#define MIR_FLUSHING_TILES_FINISHED_S 237 // Writing cached tiles to disk completed successfully.
+#define MIR_CONVERT_COMPLETED 238 // Convert operation completed successfully.
+#define MIR_COMPUTE_STATS_FOR_BAND_S 239 // Computing statistics for band %1!%r!.
+#define MIR_COMPUTE_STATS_FOR_BAND_COMPLETE_S 240 // Computing statistics for band %1!%r! completed.
+#define MIR_COMPUTE_STATS_FOR_ALL_BAND_S 241 // Computing statistics for field %1!%r! - all bands.
+#define MIR_COMPUTE_STATS_FOR_ALL_BAND_COMPLETE_S 242 // Computing statistics for all bands completed.
+#define MIR_START_COPYTO_MRRCACHE_S 243 // Started copying to MRR cache.
+#define MIR_FINISH_COPYTO_MRRCACHE_S 244 // Finished copying to MRR cache.
+#define MIR_START_COPYFROM_MRRCACHE_S 245 // Started copying from MRR cache.
+#define MIR_FINISH_COPYFROM_MRRCACHE_S 246 // Finished copying from MRR cache.
+#define MIR_UPDATING_OVERVIEWS_S 247 // Updating overviews.
+#define MIR_UPDATING_OVERVIEWS_FINISHED_S 248 // Updating overviews completed.
+#define MIR_START_CREATE_PERC_S 249 // Started creating PERC file %1!%r!.
+#define MIR_FINISH_CREATE_PERC_S 250 // Finished creating PERC file %1!%r!.
+#define MIR_START_CREATE_PPRC_S 251 // Started creating PPRC file %1!%r!.
+#define MIR_FINISH_CREATE_PPRC_S 252 // Finished creating PPRC file %1!%r!.
+#define MIR_START_CREATE_TERC_S 253 // Started creating TERC file.
+#define MIR_FINISH_CREATE_TERC_S 254 // Finished creating TERC file.
+#define MIR_CONVERTING_INPUT_FILE 255 // Convert operation started.
+#define MIR_CONVERT_1 256 // Source raster: %1!%r!.
+#define MIR_CONVERT_2 257 // Source raster format: %1!%r!.
+#define MIR_CONVERT_3 258 // Source raster size %1!%r! x %2!%r! (total of %3!%r! cells).
+#define MIR_SUGGESTINFO_FAIL 259 // Unable to Suggest Raster Info for provided inputs.
+#define MIR_WRITING_OUTPUT_FILE 260 // Writing output file.
+#define MIR_JOIN1 261 // Identified %1!%r! raster source files for joining.
+#define MIR_JOIN2 262 // Validated %1!%r! raster source files for joining.
+#define MIR_COLOR_BADFILE 263 // Invalid color file format.
+#define MIR_READ_COLOUR_FAIL 264 // Failed to read color file.
+#define MIR_COLOR_FAILWRITE 265 // Failed to write color file.
+#define MIR_SEAMLESSTAB_FAILURE 266 // Seamless TAB output failure.
+#define MIR_INTERP_LOW_MEM 267 // Warning: Available physical memory is low: %1!%r! MB reserved.
+#define MIR_INTERP_BAND_COUNT_UNEXPECTED 268 // Warning: File %1!%r! has an unexpected band count (Parse string: %2!%r!).
+#define MIR_INTERP_INPUT_CONNECTED 269 // Input stream statistics: %1!%r! sources connected, total of %2!%r! bytes (indicative).
+#define MIR_INTERP_BAND_COUNT 270 // Output raster band count: %1!%r!.
+#define MIR_INTERP_BAND_TYPE 271 // Band %1!%r!: %2!%r! Type = %3!%r!.
+#define MIR_INTERP_SPATIAL_STATS_READ 272 // Reading a small portion of the input data...
+#define MIR_INTERP_SPATIAL_STATS_WARN1 273 // Warning: Data may be reordered. Cell size recommendation may be poor.
+#define MIR_INTERP_SPATIAL_STATS_WARN2 274 // Warning: Data distribution may be clustered or skewed. Cell size recommendation may be poor.
+#define MIR_INTERP_SPATIAL_STATS_TYPE1 275 // Coordinates are UTM.
+#define MIR_INTERP_SPATIAL_STATS_TYPE2 276 // Coordinates are geodetic.
+#define MIR_INTERP_SPATIAL_STATS_SEPERATION 277 // Estimated station separation: %1!%.10g! units.
+#define MIR_INTERP_SPATIAL_STATS_DIRECTION 278 // Estimated station trend direction: %1!%.10g! degrees.
+#define MIR_INTERP_SPATIAL_STATS_CELL1 279 // Raster cell size recommendation: %1!%.10g! units.
+#define MIR_INTERP_SPATIAL_STATS_CELL2 280 // Raster cell size recommendation: %1!%.10g! units (%2!%.10g! arc sec).
+#define MIR_COINCIDENTPOINT_REPORT 281 // Found %1!%r! points coincident and %2!%r! eliminated.
+#define MIR_INTERP_TYPE6 282 // Gridding: Stamped data distance.
+#define MIR_INTERP_TYPE9 283 // Gridding: Grid stamp.
+#define MIR_INTERP_TYPE_NN 284 // Gridding: Nearest Neighbour.
+#define MIR_INTERP_TYPE_NNI 285 // Gridding: Natural Neighbour by Integration.
+#define MIR_INTERP_BAND_COUNT_FAILURE 286 // Error: Band count is zero.
+#define MIR_INTERP_VALID_STATION_COUNT_ZERO 287 // Error: No valid stations found.
+#define MIR_ERROR_CREATERASTERFILE 288 // Error: Failed to create raster file.
+#define MIR_ERROR_NOPOINTCACHE 289 // Error: No point cache.
+#define MIR_INTERP_BUILD_INPUT 290 // Build and verify the input data stream.
+#define MIR_INTERP_SPATIAL_STATS 291 // Determine representative spatial statistics.
+#define MIR_INTERP_PARSE_SORT 292 // Parsing and spatial sorting input data points and vectors.
+#define MIR_TASK_COINCIDENTPOINT 293 // Coincident point analysis.
+#define MIR_TASK_DEFINEOUTPUTTILES 294 // Declare output raster tiles.
+#define MIR_TASK_NEARESTNEIGHBOUR 295 // Grid by nearest neighbor.
+#define MIR_TASK_STAMP 296 // Grid by stamping.
+#define MIR_TASK_DISTANCE 297 // Grid by distance.
+#define MIR_TASK_DENSITY 298 // Grid by density.
+#define MIR_TASK_IDW 299 // Grid by inverse distance weighted.
+#define MIR_INTERP_EXPORT 300 // Finalize raster export.
+#define MIR_TASK_VORONOITESSELATE 301 // Populate Voronoi tesselation.
+#define MIR_TASK_VORONOIINTEGRATE 302 // Grid by natural neighbor (integration).
+#define MIR_TASK_SMOOTH 303 // Smooth.
+#define MIR_INTERP_SPATIAL_OUTOFMEM 304 // Out of memory in spatial analysis: Set the grid cell size manually to a larger value.
+#define MIR_INTERP_DATA_PYRAMID_ALLOCATION_FAIL 305 // Data pyramid memory allocation failure.
+#define MIR_INTERP_CHECK_STORAGE 306 // Checking storage volumes and system memory. This can cause a short delay.
+#define MIR_INTERP_VOLUME_INFO1 307 // Volume %1!%r! [%2!%r!]: Size %3!%r! (%4!%r! MB), Free %5!%r! (%6!%r! MB) %7!%r! %8!%r!
+#define MIR_INTERP_VOLUME_INFO2 308 // READ_ONLY
+#define MIR_INTERP_VOLUME_INFO3 309 // COMPRESSED
+#define MIR_INTERP_PHYSICAL_MEM_TOTAL 310 // Physical memory (total) : %1!%6llu! MB
+#define MIR_INTERP_PHYSICAL_MEM_AVAILABLE 311 // Physical memory (available) : %1!%6llu! MB
+#define MIR_INTERP_VIRTUAL_MEM_TOTAL 312 // Virtual memory (total) : %1!%6llu! MB
+#define MIR_INTERP_VIRTUAL_MEM_AVAILABLE 313 // Virtual memory (available) : %1!%6llu! MB
+#define MIR_INTERP_PAGING_MEM_TOTAL 314 // Paging memory (total) : %1!%6llu! MB
+#define MIR_INTERP_PAGING_MEM_AVAILABLE 315 // Paging memory (available) : %1!%6llu! MB
+#define MIR_INTERP_CHECKING_STATUS 316 // Checking status of input files.
+#define MIR_INTERP_ZIP_FAILURE 317 // Could not open the ZIP file.
+#define MIR_INTERP_ZIPITEM_FAILURE 318 // Could not find item within the ZIP file.
+#define MIR_INTERP_NO_TEMP_FOLDER 319 // Temp folder verification failure.
+#define MIR_INTERP_NO_OUTPUT_FILENAME 320 // Output filename verification failure.
+#define MIR_INTERP_SPATIAL_STATS_WARN3 321 // Estimated point separation and cell size are widely divergent.
+#define MIR_INTERP_EXTENTS 322 // Parse input, determine data extents and distribution.
+#define MIR_INTERP_EXTENTS_PARSE1 323 // Parsing for extents...
+#define MIR_INTERP_EXTENTS_PARSE2 324 // Parsing input extents (skipping %1!%r!)...
+#define MIR_INTERP_EXTENTS_PARSE3 325 // Parsing input extents...
+#define MIR_INTERP_EXTENTS_READING 326 // Reading all input files to obtain data extents and distribution statistics...
+#define MIR_INTERP_EXTENTS_SUFFIX 327 // (estimated)
+#define MIR_INTERP_EXTENTS_WARN1 328 // Warning: Statistics are based on sub-sampled data.
+#define MIR_INTERP_EXTENTS_TOTAL_POINTS 329 // Total input points: %1!%r! %2!%r!.
+#define MIR_INTERP_EXTENTS_TOTAL_VALID_POINTS 330 // Total valid input points: %1!%r! %2!%r!.
+#define MIR_INTERP_EXTENTS_SPATIALX 331 // Spatial range X: (%1!%.10g! to %2!%.10g!) %3!%.10g! %4!%r!.
+#define MIR_INTERP_EXTENTS_SPATIALY 332 // Spatial range Y: (%1!%.10g! to %2!%.10g!) %3!%.10g! %4!%r!.
+#define MIR_INTERP_EXTENTS_WARN2 333 // Warning: Point separation statistics may be invalid.
+#define MIR_INTERP_EXTENTS_POINTSEP1 334 // Point separation: less than or equal to %1!%.10g! (Avg : %2!%.10g!) : %3!%r! stations.
+#define MIR_INTERP_EXTENTS_POINTSEP2 335 // Point separation: greater than %1!%.10g! (Avg : %2!%.10g!) : %3!%r! stations.
+#define MIR_INTERP_EXTENTS_BAND_RANGE 336 // Band %1!%r! range: %2!%.10g! to %3!%.10g! %4!%r!.
+#define MIR_INTERP_EXTENTS_COVERAGE1 337 // Data coverage: Number of tiles %1!%r! occupying area %2!%.10g!.
+#define MIR_INTERP_EXTENTS_COVERAGE2 338 // Data coverage: Number of cells %1!%r! occupying area %2!%.10g!.
+#define MIR_INTERP_EXTENTS_COVERAGE3 339 // Data coverage: Minimum density %1!%.10g! points/unit area (Square of length %2!%.10g! units).
+#define MIR_INTERP_EXTENTS_COVERAGE4 340 // Data coverage: Maximum density %1!%.10g! points/unit area (Square of length %2!%.10g! units).
+#define MIR_INTERP_EXTENTS_COVERAGE5 341 // Data coverage: Mean density %1!%.10g! points/unit area (Square of length %2!%.10g! units).
+#define MIR_INTERP_EXTENTS_COVERAGE6 342 // Data coverage: Median density %1!%.10g! points/unit area (Square of length %2!%.10g! units).
+#define MIR_INTERP_EXTENTS_COVERAGE7 343 // Data coverage: Mode density %1!%.10g! points/unit area (Square of length %2!%.10g! units).
+#define MIR_INTERP_PREPARE_GRID 344 // Prepare raster parameters.
+#define MIR_INTERP_PREPARE_GRID_SIZE 345 // Raster size: (%1!%r! x %2!%r!) cells of size (%3!%.10g!, %4!%.10g!).
+#define MIR_INTERP_PREPARE_GRID_EXTENT 346 // Raster extent: (%1!%.10g! %2!%.10g!) to (%3!%.10g! %4!%.10g!).
+#define MIR_INTERP_PREPARE_GRID_WARN1 347 // Warning: No patch coverage data available as input data was not parsed.
+#define MIR_INTERP_PREPARE_GRID_PATCH1 348 // Patch coverage: %1!%r! patches of size %2!%r! x %3!%r! cells with %4!%r! points per patch.
+#define MIR_INTERP_PREPARE_GRID_PATCH2 349 // Patch coverage: %1!%r! patches occupied (estimated) with %2!%r! points per patch.
+#define MIR_INTERP_INVALID_DATA_RANGE 350 // Interpolation Data range is invalid.
+#define MIR_INTERP_EXPORT_MASK 351 // Export Source Mask.
+#define MIR_INTERP_EXPORT_MASK1 352 // Exporting Source Mask...
+#define MIR_INTERP_FINALISE_EXPORT 353 // Finalize raster export.
+#define MIR_INTERP_FINALISE_EXPORT_UNPAD 354 // Processing: un-padding raster...
+#define MIR_INTERP_PREPARE 355 // Prepare to interpolate.
+#define MIR_INTERP_PREPARE_WARN1 356 // Volume %1!%r! requires an estimated %2!%r! MB.
+#define MIR_INTERP_PREPARE_WARN2 357 // Warning: Volume %1!%r! has insufficient storage space.
+#define MIR_INTERP_PREPARE_WARN3 358 // Warning: Volume %1!%r! may run out of storage space.
+#define MIR_INTERP_PREPARE_ERROR1 359 // Error: Volume %1!%r! is read-only.
+#define MIR_INTERP_PREPARE_STAMP1 360 // Source data stamping will be performed direct to memory.
+#define MIR_INTERP_PREPARE_STAMP2 361 // Establishing data cache. This can cause a short delay...
+#define MIR_INTERP_PREPARE_STAMP3 362 // Source data will be in memory.
+#define MIR_INTERP_PREPARE_STAMP4 363 // Source data will be in virtual memory.
+#define MIR_INTERP_PREPARE_STAMP5 364 // Patch cache size: %1!%r! bytes.
+#define MIR_INTERP_PREPARE_STAMP6 365 // Warning: Estimated memory usage (%1!%r! MB) exceeds available physical memory (%2!%r! MB).
+#define MIR_INTERP_PREPARE_STAMP7 366 // Source data stamping will be performed in virtual memory.
+#define MIR_INTERP_PREPARE_STAMP8 367 // Patch size has been adjusted.
+#define MIR_INTERP_PREPARE_STAMP9 368 // Patch coverage: %1!%r! patches of size %2!%r! x %3!%r! cells with %4!%r! points per patch.
+#define MIR_INTERP_PREPARE_STAMP10 369 // Patch coverage: %1!%r! patches occupied (estimated) with %2!%r! points per patch.
+#define MIR_INTERP_PREPARE_STAMP11 370 // Up to %1!%r! stations will be cached per patch.
+#define MIR_INTERP_PREPARE_STAMP12 371 // Up to %1!%r! input stations will be internally cached.
+#define MIR_INTERP_PREPARE_STAMP13 372 // Source data stamping will be performed in-memory.
+#define MIR_INTERP_PREPARE_PATCH1 373 // Patch cache: All points will be stored in memory.
+#define MIR_INTERP_PREPARE_ESTABLISH 374 // Establishing grid files on disk.
+#define MIR_INTERP_SOURCE_MASK_FAILURE1 375 // Export source mask: Failed to open for writing.
+#define MIR_INTERP_GRID_READER_FAILURE 376 // Could not open the raster reader.
+#define MIR_INTERP_GRID_WRITER_FAILURE 377 // Could not open the raster writer.
+#define MIR_INTERP_OUTPUT_VOLUME_NOSPACE 378 // The output volume has insufficient storage space.
+#define MIR_INTERP_OUTPUT_VOLUME_MAYHAVENOSPACE 379 // The output volume may run out of storage space.
+#define MIR_INTERP_OUTPUT_VOLUME_READONLY 380 // The output volume is read-only.
+#define MIR_INTERP_SOURCE_MASK_FAILURE 381 // Source mask could not be read from file.
+#define MIR_INTERP_MATH_EXCEPTION 382 // Invalid mathematical operation attempted.
+#define MIR_INTERP_FREE_MEMORY 383 // Estimated memory usage exceeds available physical.
+#define MIR_INTERP_SYSTEM_ERROR 384 // System error trying to allocate patch memory.
+#define MIR_INTERP_FAILURE1 385 // No command line control file argument found.
+#define MIR_INTERP_FAILURE2 386 // Failed to read supplied command file.
+#define MIR_INTERP_FAILURE3 387 // Failed to build input stream.
+#define MIR_INTERP_FAILURE4 388 // Failed to parse input for statistics.
+#define MIR_INTERP_FAILURE5 389 // Failed to parse input for extents.
+#define MIR_INTERP_FAILURE6 390 // Failed to prepare raster extents.
+#define MIR_INTERP_FAILURE7 391 // Failed raster export.
+#define MIR_INTERP_FAILURE8 392 // Failed to write a final parameters command file.
+#define MIR_INTERP_FAILURE9 393 // Failed to prepare for interpolation.
+#define MIR_INTERP_FAILURE10 394 // Failed to stamp input data.
+#define MIR_INTERP_FAILURE11 395 // Failed to clip.
+#define MIR_INTERP_FAILURE12 396 // Failed first phase interpolation.
+#define MIR_INTERP_FAILURE13 397 // Failed second phase interpolation.
+#define MIR_INTERP_FAILURE14 398 // Failed third phase interpolation.
+#define MIR_INTERP_FAILURE15 399 // Failed to sort input data.
+#define MIR_INTERP_FAILURE16 400 // Failed to triangulate.
+#define MIR_INTERP_FAILURE17 401 // Failed to focus source mask.
+#define MIR_INTERP_FAILURE18 402 // Failed to export source mask.
+#define MIR_INTERP_PARSE_AND_STAMP 403 // Parse input and stamp.
+#define MIR_INTERP_PARSE_AND_STAMP1 404 // Stamping input data...
+#define MIR_INTERP_PARSE_AND_STAMP2 405 // Reading all input files and stamping to grid...
+#define MIR_INTERP_PARSE_AND_STAMP3 406 // Stamped a total of %1!%r! grid cells: %2!%.10g! percent.
+#define MIR_INTERP_PARSE_AND_STAMP4 407 // Normalizing stamped data...
+#define MIR_INTERP_PARSE_AND_STAMP_SYSERROR 408 // System error %1!%r! trying to allocate patch memory.
+#define MIR_INTERP_FINALISE 409 // Final minimum curvature iteration.
+#define MIR_INTERP_SORTING 410 // Sorting input data...
+#define MIR_INTERP_SORTING1 411 // Reading all input files and spatially sorting data...
+#define MIR_INTERP_PATCH_STATS1 412 // Patch statistics: %1!%r! occupied patches.
+#define MIR_INTERP_PATCH_STATS2 413 // Patch statistics: Maximum points %1!%r!, minimum %2!%r!.
+#define MIR_INTERP_PATCH_STATS3 414 // Patch statistics: Median points %1!%r!.
+#define MIR_INTERP_FINAL_MINC 415 // Final minimum curvature iteration.
+#define MIR_INTERP_PATCH_COLLAPSE 416 // Collapsed patch from %1!%r! stations to %2!%r! unique stations.
+#define MIR_INTERP_EXIT 417 // Exit
+#define MIR_INTERP_FINAL_CHANGE 418 // Final change: %1!%.10g!.
+#define MIR_INTERP_CACHE_FLUSH 419 // Flushing caches - there may a delay.
+#define MIR_INTERP_TRIANGULATION 420 // Triangulation.
+#define MIR_INTERP_TRIANGULATION1 421 // Triangulating...
+#define MIR_INTERP_SMALL_CACHE 422 // Warning: Raster cache is small - performance may be affected.
+#define MIR_INTERP_TRIANGULATION2 423 // Incrementally triangulating the dataset and writing to output raster.
+#define MIR_INTERP_PATCH_ROW 424 // Patch row %1!%r!:
+#define MIR_INTERP_FULL_LOAD 425 // Fully loaded
+#define MIR_INTERP_TRIANGULATION3 426 // Patch triangulation attempt failed due to memory allocation failure. Trying again...
+#define MIR_INTERP_UNLOAD 427 // Unloading
+#define MIR_INTERP_LOADED 428 // Patches loaded %1!%r!.
+#define MIR_INTERP_PYRAMID 429 // Populate pyramid upwards.
+#define MIR_INTERP_PYRAMID1 430 // Changing cache status. This can cause a short delay...
+#define MIR_INTERP_INTERPOLATING 431 // Interpolating %1!%r!% complete.
+#define MIR_INTERP_CLIP 432 // Clip.
+#define MIR_INTERP_CLIP_CREATE_MASK 433 // Creating clip mask...
+#define MIR_INTERP_CLIP_NEAR 434 // Near field search...
+#define MIR_INTERP_CLIP_FAR 435 // Far field search...
+#define MIR_INTERP_FOCUS 436 // Focus source mask.
+#define MIR_INTERP_FOCUS1 437 // Focusing source mask...
+#define MIR_INTERP_PYRAMID2 438 // Populate pyramid downwards.
+#define MIR_INTERP_EXPORT1 439 // Exporting raster...
+#define MIR_INTERP_EXPORT_HEADER 440 // Writing raster header...
+#define MIR_INTERP_EXPORT_HEADER1 441 // Output header: %1!%r!.
+#define MIR_INTERP_EXPORT_DATA 442 // Writing raster data...
+#define MIR_INTERP_EXPORT2 443 // Output: %1!%r!.
+#define MIR_INTERP_WRITE_TAB 444 // Writing TAB companion...
+#define MIR_INTERP_WRITE_TAB1 445 // Output TAB companion: %1!%r!.
+#define MIR_INTERP_COMMAND_FILE 446 // Input command file: %1!%r!.
+#define MIR_INTERP_ESTIMATE 447 // Statistics: Estimating appropriate cell size.
+#define MIR_INTERP_TERMINATED 448 // Terminated...
+#define MIR_INTERP_PHASE1 449 // Interpolation phase 1...
+#define MIR_INTERP_PHASE2 450 // Interpolation phase 2...
+#define MIR_INTERP_PHASE3 451 // Interpolation phase 3...
+#define MIR_INTERP_STAMP_COMPLETE 452 // Stamping %1!%r!% complete.
+#define MIR_INTERP_EXPORT_COMPLETE 453 // Exporting %1!%r!% complete.
+#define MIR_INTERP_OUTPUT_HEADER_FAILED 454 // Output header: Failed to open for writing.
+#define MIR_INTERP_OUTPUT_BIL_FAILED 455 // Output BIL: Failed to open for writing.
+#define MIR_INTERP_OUTPUT_TAB_FAILED 456 // Output TAB companion: Failed to open for writing.
+#define MIR_INTERP_OPEN_CREATE_FAILED 457 // Could not create output file.
+#define MIR_INTERP_ITERATOR_FAILED 458 // Could not create iterator to write to output file.
+#define MIR_INTERP_ERROR 459 // An error has occurred during interpolating a grid.
+#define MIR_INTERP_TYPE1 460 // Gridding: Stamped minimum curvature.
+#define MIR_INTERP_TYPE2 461 // Gridding: Minimum curvature.
+#define MIR_INTERP_TYPE3 462 // Gridding: Delaunay triangulation with linear interpolation.
+#define MIR_INTERP_TYPE4 463 // Gridding: Stamped inverse distance.
+#define MIR_INTERP_TYPE5 464 // Gridding: Stamped data density.
+#define MIR_INTERP_TYPE7 465 // Processing: Raster Padding.
+#define MIR_INTERP_TYPE8 466 // Processing: Raster Unpadding.
+#define MIR_INTERP_OUTPUTFILES 467 // Determining output file names.
+#define MIR_INTERP_CLEAN 468 // Clearing memory and erasing temporary files...
+#define MIR_INTERP_INVALID_TAB_INTERNAL 469 // Invalid TAB format: %1!%r!.
+#define MIR_INTERP_INVALID_INPUT_POINTS 470 // There are no valid input points.
+#define MIR_INTERP_JANUARY 471 // January
+#define MIR_INTERP_FEBRUARY 472 // February
+#define MIR_INTERP_MARCH 473 // March
+#define MIR_INTERP_APRIL 474 // April
+#define MIR_INTERP_MAY 475 // May
+#define MIR_INTERP_JUNE 476 // June
+#define MIR_INTERP_JULY 477 // July
+#define MIR_INTERP_AUGUST 478 // August
+#define MIR_INTERP_SEPTEMBER 479 // September
+#define MIR_INTERP_OCTOBER 480 // October
+#define MIR_INTERP_NOVEMBER 481 // November
+#define MIR_INTERP_DECEMBER 482 // December
+#define MIR_INTERP_MONDAY 483 // Monday
+#define MIR_INTERP_TUESDAY 484 // Tuesday
+#define MIR_INTERP_WEDNESDAY 485 // Wednesday
+#define MIR_INTERP_THURSDAY 486 // Thursday
+#define MIR_INTERP_FRIDAY 487 // Friday
+#define MIR_INTERP_SATURDAY 488 // Saturday
+#define MIR_INTERP_SUNDAY 489 // Sunday
+#define MIR_INTERP_NULL_FIELD_BAND 948 // Grid %1!%r! not written as it only contains null data.
+#define MIR_INTERP_INVALID_TAB_NOT_MAPPABLE_INTERNAL 949 // Non mappable TAB file %1!%r! is not supported.
+#define MIR_INTERP_INPUT_FILE_COUNT_ZERO 490 // Input file count is zero.
+#define MIR_INTERP_INPUT_DATAFORMAT_INVALID 491 // Input file data format is invalid.
+#define MIR_INTERP_INPUT_FILENAME_INVALID 492 // Input file name is invalid.
+#define MIR_INTERP_INPUT_ZIPFILE_INVALID 493 // Input ZIP file does not contain a valid input file format.
+#define MIR_INTERP_INPUT_DATAFIELD_COUNT_ZERO 494 // No data columns have been selected in the Input file.
+#define MIR_INTERP_OUTPUT_FILENAME_INVALID 495 // Output file name is invalid.
+#define MIR_INTERP_OUTPUT_RASTER_FORMAT_INVALID 496 // Output file raster format is invalid.
+#define MIR_INTERP_OUTPUT_DATATYPE_COUNT_ZERO 497 // Output file defined data type count is zero.
+#define MIR_INTERP_OUTPUT_DATATYPE_INVALID 498 // Output file defined data type is invalid.
+#define MIR_INTERP_OUTPUT_COORDSYS_INVALID 499 // Output file coordinate system is invalid.
+#define MIR_INTERP_GEOMETRY_CELLSIZE_INVALID 500 // Geometry cell size is invalid, must be greater than 0.
+#define MIR_INTERP_GEOMETRY_CELLCOUNT_INVALID 501 // Geometry cell count is invalid, must be greater than 0.
+#define MIR_INTERP_TRIANGULATION_PATCHMULTIPLIER_INVALID 502 // Triangulation patch multiplier is invalid.
+#define MIR_INTERP_TRIANGULATION_LONGTRIANGLE_INVALID 503 // Triangulation longest triangle is invalid.
+#define MIR_INTERP_IDW_RADIUSX_INVALID 504 // Inverse Distance Weighted radius X is invalid.
+#define MIR_INTERP_IDW_RADIUSY_INVALID 505 // Inverse Distance Weighted radius Y is invalid.
+#define MIR_INTERP_IDW_SEARCH_INCREMENT_INVALID 956 // Inverse Distance Weighted search increment is invalid, valid values are 1 or greater.
+#define MIR_INTERP_DISTANCE_RADIUSX_INVALID 506 // Distance radius X is invalid.
+#define MIR_INTERP_DISTANCE_RADIUSY_INVALID 507 // Distance radius Y is invalid.
+#define MIR_INTERP_DENSITY_RADIUSX_INVALID 508 // Density radius X is invalid.
+#define MIR_INTERP_DENSITY_RADIUSY_INVALID 509 // Density radius Y is invalid.
+#define MIR_INTERP_STAMP_METHOD_INVALID 510 // Stamp method is invalid.
+#define MIR_INTERP_MINCURV_RADIUS_INVALID 511 // Minimum Curvature radius is invalid.
+#define MIR_INTERP_CONTROL_FILE_INVALID 512 // Control file name is invalid.
+#define MIR_INTERP_X_INVALID 513 // The X column index is invalid.
+#define MIR_INTERP_Y_INVALID 514 // The Y column index is invalid.
+#define MIR_INTERP_GROUP_INVALID 515 // The Group column index is invalid.
+#define MIR_INTERP_X_Y_INVALID 516 // The X and Y column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_X_GROUP_INVALID 517 // The X and Group column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_Y_GROUP_INVALID 518 // The Y and Group column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_DATA_INVALID 519 // The Data column index is invalid.
+#define MIR_INTERP_X_DATA_INVALID 520 // The X and Data column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_Y_DATA_INVALID 521 // The Y and Data column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_GROUP_DATA_INVALID 522 // The Group and Data column indexes are invalid, they cannot be the same.
+#define MIR_INTERP_DATA_INDEX_COUNT_INVALID 523 // The data column indexes are invalid. The input file and data index count mismatched, they need to be the same.
+#define MIR_INTERP_NEARFAR_LESS_THAN_ONE 524 // Near or Far clipping parameter invalid, must be 1 or greater.
+#define MIR_INTERP_INVALID_ASCII_FILE 525 // Invalid ASCII file format.
+#define MIR_INTERP_COORDINATE_CONDITIONING_INVALID 526 // Coordinate conditioning parameters are invalid.
+#define MIR_INTERP_DATA_CONDITIONING_INVALID 527 // Data conditioning parameters are invalid.
+#define MIR_INTERP_LASZIP_DLL_NOT_LOADED 528 // LASZip DLL was not loaded.
+#define MIR_INTERP_LASZIP_ERROR_READING_FILE 529 // An error occurred while reading the LASZip file.
+#define MIR_INTERP_NN_SEARCH_DISTANCE_INVALID 530 // Search distance should be greater than 0.
+#define MIR_INTERP_NNI_SEARCH_DISTANCE_INVALID 531 // Search distance should be greater than 0.
+#define MIR_INTERP_NNI_GAUSSIAN_RANGE_INVALID 532 // Gaussian range should be greater than 0.
+#define MIR_INTERP_INVALID_LAS 533 // Invalid LAS format header signature, file needs to be of type LASF.
+#define MIR_INTERP_INVALID_TAB 534 // Invalid TAB format.
+#define MIR_INTERP_NEARFAR_LESS_THAN_ZERO 535 // Near or Far clipping parameter invalid, must be greater than 0.
+#define MIR_INTERP_NEAR_GREATER_THAN_FAR 536 // Near or Far clipping parameter invalid, Near must be less than Far.
+#define MIR_INTERP_SMOOTHING_INVALID 537 // The Smoothing parameter is invalid.
+#define MIR_INTERP_PATCH_SIZE_INVALID 538 // Patch size for triangulation exceeds 44 million points, reduce cell size and try again.
+#define MIR_INTERP_DATA_TYPE_FOR_MIN_MAX_INVALID 539 // Column data type is invalid for minimum and maximum comparisons.
+#define MIR_INTERP_POLYGONFILE_INVALID 540 // The supplied polygon file for clipping is invalid.
+#define MIR_INTERP_CLIPPING_METHOD_INVALID 541 // The clipping method supplied is invalid for this interpolation method.
+#define MIR_INTERP_INVALID_TAB_NOT_MAPPABLE 950 // Non-mappable TAB files are not supported.
+#define MIR_INTERP_IDW_SECTOR_COUNT_INVALID 951 // Inverse Distance Weighted sector count is invalid, valid values are 1 to 32.
+#define MIR_INTERP_IDW_MIN_POINTS_INVALID 952 // Inverse Distance Weighted sector minimum points is invalid, valid values are 1 and greater.
+#define MIR_INTERP_IDW_MAX_POINTS_INVALID 953 // Inverse Distance Weighted sector maximum points is invalid, valid values are 1 and greater.
+#define MIR_INTERP_IDW_MIN_SECTORS_INVALID 954 // Inverse Distance Weighted sector minimum valid count is invalid, valid values are 1 and greater.
+#define MIR_INTERP_IDW_SECTOR_ORIENTATION_INVALID 955 // Inverse Distance Weighted sector orientation is invalid, valid values are 0 to 360.
+#define MIR_INTERP_LIDAR_CLASS_0 927 // Created, never classified
+#define MIR_INTERP_LIDAR_CLASS_1 928 // Unclassified
+#define MIR_INTERP_LIDAR_CLASS_2 929 // Ground
+#define MIR_INTERP_LIDAR_CLASS_3 930 // Low Vegetation
+#define MIR_INTERP_LIDAR_CLASS_4 931 // Medium Vegetation
+#define MIR_INTERP_LIDAR_CLASS_5 932 // High Vegetation
+#define MIR_INTERP_LIDAR_CLASS_6 933 // Building
+#define MIR_INTERP_LIDAR_CLASS_7 934 // Low Point (Low noise)
+#define MIR_INTERP_LIDAR_CLASS_8 935 // Model Key/Reserved
+#define MIR_INTERP_LIDAR_CLASS_9 936 // Water
+#define MIR_INTERP_LIDAR_CLASS_10 937 // Rail
+#define MIR_INTERP_LIDAR_CLASS_11 938 // Road Surface
+#define MIR_INTERP_LIDAR_CLASS_12 939 // Bridge Deck
+#define MIR_INTERP_LIDAR_CLASS_13 940 // Wire - Guard (Shield)
+#define MIR_INTERP_LIDAR_CLASS_14 941 // Wire - Conductor (Phase)
+#define MIR_INTERP_LIDAR_CLASS_15 942 // Transmission Tower
+#define MIR_INTERP_LIDAR_CLASS_16 943 // Wire-structure Connector (Insulator)
+#define MIR_INTERP_LIDAR_CLASS_17 944 // Bridge
+#define MIR_INTERP_LIDAR_CLASS_18 945 // High Point (High noise)
+#define MIR_INTERP_LIDAR_CLASS_19_63 946 // Reserved for ASPRS Definition
+#define MIR_INTERP_LIDAR_CLASS_64_255 947 // User defined
+#define MIR_CONTOUR_ELAPSED 542 // Elapsed time: %1!%r! s
+#define MIR_CONTOUR_VERIFY_INPUT 543 // Verifying input data sources...
+#define MIR_CONTOUR_NO_TEMP 544 // Error: The temporary file folder %1!%r! does not exist.
+#define MIR_CONTOUR_COORDSYS_FAILURE 545 // Failed to assign coordinate system to output.
+#define MIR_CONTOUR_MINIMUM_SUPPORT 546 // Minimum contour level could not be supported, modified from %1!%r! to %2!%r!.
+#define MIR_CONTOUR_MAXIMUM_SUPPORT 547 // Maximum contour level could not be supported, modified from %1!%r! to %2!%r!.
+#define MIR_CONTOUR_PREPARE2 548 // Preparing to contour...
+#define MIR_PLYGISE_GENERATING 549 // Generating polygons...
+#define MIR_CONTOUR_INVALID_EXTENTS 550 // Contouring extents are invalid.
+#define MIR_CONTOUR_REGION1 551 // Contouring region from (%1!%r!, %2!%r!) to (%3!%r!, %4!%r!)
+#define MIR_CONTOUR_REGION2 552 // Contouring region over (%1!%r!, %2!%r!) cells of dimension (%3!%r!, %4!%r!)
+#define MIR_CONTOUR_PHYSICAL_LOW2 553 // Warning: The available physical memory is low - performance may be affected.
+#define MIR_CONTOUR_2 554 // Generating contours...
+#define MIR_CONTOUR_FINALISED 555 // Finalized %1!%r! contours with %2!%r! in progress and %3!%r! deferred...
+#define MIR_PLYGISE_INPROGRESS 556 // Finalized %1!%r! polygons with %2!%r! in progress and %3!%r! deferred...
+#define MIR_CONTOUR_FINALISE_2 557 // Finalizing contours...
+#define MIR_PLYGISE_FINALISE 558 // Finalising polygons...
+#define MIR_CONTOUR_EXPORT_2 559 // Exporting contours...
+#define MIR_PLYGISE_EXPORT 560 // Exporting polygons...
+#define MIR_CONTOUR_EXPORT_3 561 // Exporting a total of %1!%r! contours.
+#define MIR_CONTOUR_EXPORT_MULT_1 562 // Multiple output contour files will be generated.
+#define MIR_CONTOUR_EXPORT_MULT_2 563 // A total of %1!%r! output contour files will be written.
+#define MIR_CONTOUR_EXPORT_OUTPUT 564 // Created output file %1!%r! (%2!%r! lines and %3!%r! points).
+#define MIR_CONTOUR_GENERATE_1 565 // Loaded command file: %1!%r!.
+#define MIR_CONTOUR_GENERATE_FAIL0 566 // No command line control file argument found.
+#define MIR_CONTOUR_GENERATE_FAIL1 567 // Failed to read supplied command file.
+#define MIR_CONTOUR_GENERATE_FAIL2 568 // Failed to verify input raster file.
+#define MIR_CONTOUR_GENERATE_FAIL3 569 // Failed to initialize operation.
+#define MIR_CONTOUR_GENERATE_FAIL4 570 // Failed to execute operation.
+#define MIR_CONTOUR_GENERATE_FAIL5 571 // Failed to finalize operation.
+#define MIR_CONTOUR_GENERATE_FAIL6 572 // Failed to export.
+#define MIR_CONTOUR_REMOVE_DUPLICATE 573 // Removing duplicate manual level %1!%r!
+#define MIR_CONTOUR_AREA_REMOVED 574 // Number of contours removed under %1!%f! in size = %2!%r!
+#define MIR_CONTOUR_NO_INPUT_FILE 575 // Unable to open input file for contouring.
+#define MIR_MINCONTOUR_GREATERTHAN_MAXCONTOUR 576 // The minimum contour value is greater than the maximum contour value.
+#define MIR_CONTOUR_COUNT_ZERO 577 // Zero contours have been generated, output file will not be created.
+#define MIR_CONTOUR_NO_MANUAL_LEVELS 578 // Level Type is set to manual but no manual levels have been provided.
+#define MIR_CONTOUR_RASTER_OPEN_FAILURE 579 // Failed to open raster.
+#define MIR_CONTOUR_STATS_FAILURE 580 // Failed to acquire raster statistics.
+#define MIR_CONTOUR_TAB_FAILURE 581 // TAB output failure.
+#define MIR_CONTOUR_INVALID_SPACING 582 // Contour spacing cannot be a negative value.
+#define MIR_CONTOUR_INVALID_LINESTYLE_NONE 583 // Contour line style pattern cannot be set to PAT_NONE or a negative value.
+#define MIR_CONTOUR_INVALID_MAJORSTEP 584 // Major step cannot be a negative value.
+#define MIR_CONTOUR_INVALID_BRUSHSTYLE_NONE 585 // Contour brush style pattern cannot be set to a negative value.
+#define MIR_CONTOUR_INVALID_MIN_AREA 586 // Minimum defined contour area cannot be negative.
+#define MIR_CONTOUR_DUPLICATE_LEVEL 587 // A duplicate contour level has been found, please remove any duplicated levels.
+#define MIR_CONTOUR_INVALID_LINEWIDTH 588 // Contour line width can only be set to 0 if line style pattern is set to PAT_HOLLOW.
+#define MIR_CONTOUR_NOMEM 589 // Memory failure occurred during contouring.
+#define MIR_CONTOUR_ERROR 590 // An error has occurred during contour processing.
+#define MIR_POLY_ERROR 591 // An error has occurred during polygon processing.
+#define MIR_CONTOUR_LOWERBOUND 592 // Lower_Bound
+#define MIR_CONTOUR_UPPERBOUND 593 // Upper_Bound
+#define MIR_CONTOUR_LEVEL 594 // Level
+#define MIR_CONTOUR_INDEX 595 // Index
+#define MIR_CONTOUR_CLASS 596 // Class
+#define MIR_CONTOUR_VALUE 597 // Value
+#define MIR_CONTOUR_LABEL 598 // Label
+#define MIR_CLASSLBL_FIELD_NOT_FOUND 599 // Class Label field not found in class table.
+#define MIR_CLASSID_FIELD_NOT_FOUND 600 // Class ID field not found in class table.
+#define MIR_COLOUR_PALETTE_NOTFOUND 601 // Failed to find color palette directory.
+#define MIR_LEGEND_GHX_MISSING 602 // There is no GHX file for this Raster.
+#define MIR_ERR_FIELD_TYPE_NOT_ALLOWED 603 // Field type is not allowed by the driver.
+#define MIR_ERR_LEGEND_INVALID_RENDER_STYLE 604 // Legend not supported for this render style.
+#define MIR_LEGEND_NO_INFLECTION_DATA 605 // There is no inflection data for this raster.
+#define MIR_WRITE_LEGEND_FAIL 606 // Failed to write legend file.
+#define MIR_NORELEASE 607 // Unable to release memory.
+#define MIR_TRACKER_CREATE_FAIL 608 // Memory allocation failure. Could not create a process tracker object.
+#define MIR_FILE_ABSPATH_ERROR 609 // Absolute path error.
+#define MIR_FILE_INVALID_EXTN 610 // Invalid file extension.
+#define MIR_LOCATION_OFF_GRID 611 // Location provided is outside the raster extents.
+#define MIR_INVALID_COMPRESSION 612 // An invalid compression method has been provided.
+#define MIR_INVALID_FINALISE_ARGS 613 // Invalid finalization option.
+#define MIR_READ_CONFIG_FAIL 614 // Failed to read configuration file.
+#define MIR_FAIL_EXTRACT_FNAME 615 // Unable to extract file name from the given file.
+#define MIR_BEGIN_INTERP_FAILED 616 // Unable to start interpolator.
+#define MIR_TABLE_UNAVAILABLE 617 // Invalid input table.
+#define MIR_INVALID_RECORD 618 // An invalid table record index has been passed.
+#define MIR_EDIT_PROPERTY_NOT_SUPPORTED 619 // Editing the raster property is not supported.
+#define MIR_EDIT_PROPERTY_INVALID_VALUE 620 // Invalid property value.
+#define MIR_EDIT_PROPERTY_NOT_FOUND 621 // No property found to edit.
+#define MIR_CONTOUR_INVALID_MANUAL_LEVEL_NULL 622 // Number of manual levels is greater than zero but the manual level array has not been initialized.
+#define MIR_INVALID_FIELD_BAND_FILTER 623 // Invalid Field and Band filter for current operation.
+#define MIR_CONTOUR_SUGGESTED_REGION_SIZE 624 // Sub-region size is too small. Suggested sub-region size is X=%1!%r! Y=%2!%r!.
+#define MIR_CONTOUR_REGION_SIZE_TOO_SMALL 625 // Sub-region size is too small, increase the sub-region size.
+#define MIR_CONTOUR_CELLCOUNT_ZERO 626 // Cell count to contour is zero.
+#define MIR_CONTOUR_BLOCK_ERROR 627 // Block %1!%r! error: %2!%r!
+#define MIR_CONTOUR_BLOCK_PROCESS 628 // Processing block %1!%r! of %2!%r! for cell indexes (%3!%r!,%4!%r! to %5!%r!,%6!%r!) %7!%r!
+#define MIR_CONTOUR_CREATING_SEAMLESS 629 // Creating seamless table: %1!%r!
+#define MIR_CONTOUR_SEAMLESSTAB_FAILURE 630 // Seamless TAB output failure.
+#define MIR_CONTOUR_CREATED_SEAMLESS 631 // Created seamless table: %1!%r!
+#define MIR_RESOLUTION_RANGE_UNAVAILABLE 632 // Unable to retrieve resolution range for the raster file.
+#define MIR_FAIL_EPSG_NOTFOUND 633 // EPSG code matching MapInfo projection string not found.
+#define MIR_StatisticsFail 634 // Statistics failure.
+#define MIR_CLIPRECT_NO_OVERLAP 635 // No overlap found between raster and clip extent.
+#define MIR_DRIVER_NO_MULTI_FIELD_SUPPORT 636 // Selected driver does not provide Multi-field support for output.
+#define MIR_ALL_BANDS_SAME_TYPE 637 // Field type must match for all input rasters selected.
+#define MIR_CONTOUR_FIELD_INVALID 638 // Specified input Field does not exist.
+#define MIR_CONTOUR_BAND_INVALID 639 // Specified input Band does not exist.
+#define MIR_CONTOUR_VERIFY_INPUT_FAILURE 640 // Verify input file failure.
+#define MIR_CONTOUR_NO_OUTPUT_FOLDER 641 // The output grid file folder does not exist.
+#define MIR_CONTOUR_LOW_MEMORY 642 // Contouring is experiencing low memory. Adjust parameters and try again.
+#define MIR_FAIL_WRITE_STRUCTURE 643 // Unable to write structure.
+#define MIR_SAME_RASTER_TAB 644 // Input Raster's TAB file and Output Vector TAB file are at same location with same Name.
+#define MIR_FILTER_ONLY_SUPPORTS_ODD_KERNEL_ROW_COL 645 // Filter only supports odd numbers of rows and columns in the kernel.
+#define MIR_CLASSIFIED_FILTER_MIN_REGION_SIZE_TOO_LARGE 646 // The minimum region size for the classified filter is too large.
+#define MIR_NO_POINT_OBJECTS_FOUND 647 // No point objects found in Input vector file.
+#define MIR_ONLY_CONTINOUS_CLASSIFIED_SUPPORTED 648 // Field type is not valid, only Continuous and Classified fields allowed.
+#define MIR_IMPORT_DRIVER_NO_MULTI_BAND_SUPPORT 649 // Selected Driver doesn't provide Multi-band Support to Import.
+#define MIR_FILE_ACCESS_ERROR 650 // The file is not present or the user does not have access permission.
+#define MIR_SAME_SOURCE_DESTINATION 651 // Input and output file names are same.
+#define MIR_INVALID_VECTOR_FILE 652 // Invalid vector file.
+#define MIR_INVALID_CELLSIZE 653 // Invalid cell size.
+#define MIR_SOURCE_ORIGIN_NOT_VALID_CELL 654 // Source origin not over a valid cell, so height cannot be determined.
+#define MIR_DEST_ORIGIN_NOT_VALID_CELL 655 // Destination origin not over a valid cell, so height cannot be determined.
+#define MIR_MERGE_INCOMPATIBLE_GRIDS 656 // Input rasters are not compatible for merge operation.
+#define MIR_MRT_NOT_SUPPORTED 657 // Multi-resolution output is not supported by selected output driver.
+#define MIR_FAIL_SET_TABLE_RECORD 658 // Unable to set classification table record.
+#define MIR_INVALID_BANDED_AND_NONBANDED_COMBINATION 659 // You cannot mix banded and non-banded notation for the same raster/field in an expression.
+#define MIR_RASTER_FORMAT_ONLY_SINGLE_BANDED 660 // Raster format does not support multiple bands.
+#define MIR_START_FILE_OPEN_S 661 // Opening file %1!%r!.
+#define MIR_CLASSIFIED_OUTPUT_NOT_VALID 662 // Classified raster output is not supported for the specified parameters.
+#define MIR_GRIDS_DO_NOT_OVERLAP 663 // Source rasters do not overlap.
+#define MIR_CLASSIFIED_RASTERS_CAN_NOT_HAVE_MULTIPLE_BANDS 664 // Cannot create a classified raster with multiple bands.
+#define MIR_INVALID_MULTIBAND_CONTINUOUS_TO_IMAGE_INVALID 665 // You cannot convert a multi-band continuous raster directly to an image raster. Try using the individual bands.
+#define MIR_TOO_MANY_CALCULATOR_EXPRESSIONS 666 // You cannot have more calculator expressions than there are bands.
+#define MIR_WRONG_NUMBER_OF_CALCULATOR_EXPRESSIONS 667 // There must either be one expression or one expression for each band.
+#define MIR_CALCULATING 668 // Calculate operation started.
+#define MIR_BEGIN_INTERPOLATE_FAILED 669 // Failure while creating interpolator.
+#define MIR_CALCULATING_COMPLETE_S 670 // Calculating %1!%r!% complete.
+#define MIR_CREATING_FILE_S 671 // Creating output file %1!%r!.
+#define MIR_CALCULATE_COMPLETED 672 // Calculate operation completed successfully.
+#define MIR_VALID_EXPRESSION 673 // Valid expression.
+#define MIR_TOO_MANY_RASTER_ALIASES 674 // Too many raster aliases.
+#define MIR_OPERATION_STARTED_S 675 // %1!%r! operation started.
+#define MIR_CLIP_RASTER_TO_RASTER_OPERATION_NAME 676 // Clip raster to raster
+#define MIR_OPERATION_ENDED_S 677 // %1!%r! operation ended.
+#define MIR_CORDSYS_UNAVAILABLE 678 // Coordinate system is unavailable.
+#define MIR_CLIP_STARTED 679 // Clip operation started.
+#define MIR_INPUT_POLY_BOUNDS 680 // Input polygon world space clip bounds MinX: %1!%g! MaxX: %2!%g! MinY: %3!%g! MaxY: %4!%g!.
+#define MIR_INPUT_CELL_BOUNDS 681 // Input polygon Cell space clip bounds MinX: %1!%r! MaxX: %2!%r! MinY: %3!%r! MaxY: %4!%r!.
+#define MIR_INPUT_POLY_RETAIN 682 // Retain Inside Polygon: %1!%r!.
+#define MIR_CLIP_COMPLETED 683 // Clip operation completed successfully.
+#define MIR_VEC_FEATURE_NOTFOUND 684 // No supported vector feature found.
+#define MIR_TPIP_FAIL_ALLOCATE 685 // TPIP error, failed to allocate memory.
+#define MIR_TPIP_FAIL_PROCESS 686 // TPIP processing failed.
+#define MIR_SET_RANDOM_BLOCK_FAILED 687 // Failed to set Random Block.
+#define MIR_GET_RANDOM_BLOCK_FAILED 688 // Failed to get Random Block.
+#define MIR_CLIP_COMPLETE_S 689 // Clipping %1!%r!% complete.
+#define MIR_DRIVER_NO_MULTI_BAND_SUPPORT 690 // Selected driver does not provide Multi-band support to output.
+#define MIR_ALL_FIELDS_PROJECTION_NOT_MATCHING 691 // Projection must match for all selected rasters.
+#define MIR_ERR_MULTIPLE_NONCONTINUOUS 692 // Multiple non-continuous fields are not allowed in the same field.
+#define MIR_ALL_BANDS_CELLSIZE_MUST_MATCH 693 // Field Cell size must match for all input rasters selected.
+#define MIR_ALL_BANDS_TILEORIGIN_MUST_MATCH 694 // Field Origin must match for all input rasters selected.
+#define MIR_POPULATEDATA_FIELDID_D 695 // Populating data into destination raster fieldIndex: %1!%r!.
+#define MIR_MATCH_INPUT_GEOMTRY 696 // Verifying compatibility of all input raster's geometry.
+#define MIR_COMBINE_STARTED 697 // Combine operation Started.
+#define MIR_POPULATERASTER_DATA 698 // Populating data in destination raster.
+#define MIR_WRITING_OUTPUT_RASTER_S 699 // Start creating %1!%r! output raster file.
+#define MIR_COMBINE_COMPLETED 700 // Combine operation completed successfully.
+#define MIR_DIRECTORY_NOT_WRITEABLE 701 // Directory is not writable.
+#define MIR_COPY_RASTER 702 // Copy Operation Started.
+#define MIR_COPYING_FILE_S 703 // Copying %1!%r! and associated files.
+#define MIR_COPY_FAIL 704 // Failed to copy file.
+#define MIR_COPY_COMPLETED 705 // Copy operation completed successfully.
+#define MIR_DELETE_START 706 // Delete operation started.
+#define MIR_DELETE_RASTER 707 // Deleting raster file...
+#define MIR_DELETING_FILE_S 708 // Deleting %1!%r! and associated files.
+#define MIR_DELETE_FAIL1 709 // Not able to delete file %1!%r! error code: %2!%r!.
+#define MIR_DELETE_FAIL2 710 // Not able to delete file %1!s !with extension %2!%r! from Destination Directory %3!%r!.
+#define MIR_DELETE_ASSOCIATED 711 // Deleting associated files...
+#define MIR_DELETE_FAIL3 712 // Not able to delete file %1!%r! with extension %2!%r! error code: %3!%r!.
+#define MIR_DELETE_COMPLETED 713 // Delete operation completed successfully.
+#define MIR_RENAME_START 714 // Rename operation started.
+#define MIR_RENAME_FAIL1 715 // Not able to rename file %1!%r! to %2!%r!.
+#define MIR_NOT_SUPPORTED 716 // Not a supported operation.
+#define MIR_RENAMING_FILE_S 717 // Renaming %1!%r! and associated files.
+#define MIR_RENAME_FAIL2 718 // Not able to rename file %1!%r! with extension %2!%r! to %3!%r!.
+#define MIR_RENAME_COMPLETED 719 // Rename operation completed successfully.
+#define MIR_EXPORT_START 720 // Export operation started.
+#define MIR_OUTPUT_EXISTS2 721 // Output File %1!%r! exists, exiting as overwrite flag is false.
+#define MIR_EXPORT_STARTED 722 // Grid Export operation started.
+#define MIR_EXPORT_COMPLETED 723 // Grid Export operation completed successfully.
+#define MIR_INVALID_DELIMITER 724 // An invalid delimiter (like '.') has been provided.
+#define MIR_EXPORTTOASCII_COMPLETE_S 725 // Export to ASCII %1!%r!% complete.
+#define MIR_EXPORTTOTAB_COMPLETED 726 // Export to TAB file operation is completed.
+#define MIR_FAIL_COLOR_INFO 727 // Failed to get Color Information for this Raster.
+#define MIR_FILE_NOT_EXIST 728 // File does not exist.
+#define MIR_ELLIS_INIT_FAIL 729 // Ellis Initialization failed.
+#define MIR_COORDSYS_NOT_PRESENT 730 // CoordSys not present in input file, Using CoordSys supplied by user.
+#define MIR_EXPORTTOTAB_MEM_FAIL 731 // Operation may fail because of insufficient memory to Run.
+#define MIR_NATIVE_TAB_LIMIT 732 // TAB file creation will fail because of size restriction. Setting it to Extended TAB format.
+#define MIR_TAB_METADATA_FAIL 733 // Failed to set Table Meta Data.
+#define MIR_CREATE_TAB_FAIL 734 // Failed to create the TAB file.
+#define MIR_INSERT_TAB_FAIL 735 // Failed to insert object into the TAB file.
+#define MIR_EXPORTTOTAB_COMPLETE_S 736 // Export to TAB %1!%r!% complete.
+#define MIR_INVALID_OUTPUT_FIELD_TYPE 737 // Invalid output field type.
+#define MIR_FILTERING 738 // Filter operation started.
+#define MIR_FILTERING_COMPLETE_S 739 // Filtering %1!%r!% complete.
+#define MIR_FILTER_COMPLETED 740 // Filter operation completed successfully.
+#define MIR_FAIL_READ_KERNEL_FILE 741 // Failed to process input kernel file.
+#define MIR_INVALID_EXPORT_FILE 742 // Input file is not a valid exported file. Please add the standard header before proceeding.
+#define MIR_INVALID_EXPORT_FILE_VERSION 743 // Input file is not a valid exported file. Please add the standard header version before proceeding.
+#define MIR_INVALID_RASTER_SIZE 744 // Input file does not have valid rows and columns in header.
+#define MIR_IMPORT_START 745 // Import operation started.
+#define MIR_IMPORT_DRIVER_NO_MULTI_FIELD_SUPPORT 746 // Selected Driver doesn't provide Multi-field Support to Import.
+#define MIR_IMPORT_STARTED 747 // Grid Import operation started.
+#define MIR_IMPORT_COMPLETE_S 748 // Importing %1!%r!% complete.
+#define MIR_IMPORT_COMPLETED 749 // Grid Import operation completed successfully.
+#define MIR_COMP_STATS 750 // GetComputeStats:
+#define MIR_COMP_STAT_VAL 751 // Val: %1!%f! IsValid: %2!%r!
+#define MIR_INVALID_ARG_REQD_STAT_MISSING 752 // Select at least one statistics attribute.
+#define MIR_UNDEFINED_UNITCODE 753 // Input raster's unit code is not defined.
+#define MIR_WARN_RASTER_COORDSYS 754 // Warning! coordinate system is not present in the raster file %1!%r!, assuming its coordinate system is the same as the input vector file.
+#define MIR_COMP_POINTS 755 // GridPointsValues (x,y)
+#define MIR_COMP_POINTS_VAL 756 // Point[%1!%g!, %2!%g!]
+#define MIR_LINE_INSPECTION_START 757 // Line Inspection operation started.
+#define MIR_START_READ_VECTOR_FILE_S 758 // Start reading %1!%r! vector file.
+#define MIR_READFAIL 759 // Unable to read file.
+#define MIR_END_READ_VECTOR_FILE 760 // Vector file reading completed.
+#define MIR_NO_LINE_OBJECTS_FOUND 761 // No line objects found in input vector file.
+#define MIR_N_VECTOR_OBJECTS_FOUND_D_S 762 // %1!%r! %2!%r! objects found in input vector file.
+#define MIR_BEGIN_LINE_INSPECTION 763 // Line Inspection started for %1!%r!.
+#define MIR_END_LINE_INSPECTION 764 // Line inspection completed for %1!%r!.
+#define MIR_OUTPUT_VECTOR_WRITE_FAIL 765 // Unable to create output Tab file.
+#define MIR_LINE_INSPECTION_COMPLETED 766 // Line Inspection operation completed successfully.
+#define MIR_NONSPATIAL_UNITCODE 767 // Unit code is not a valid spatial unit code.
+#define MIR_SAMPLE_POINT_GENERATE_D 768 // Generating %1!%r! sample points between view points.
+#define MIR_LINEOFSIGHT_OPERATION_NAME 769 // Line of sight
+#define MIR_OPERATION_COMPLETE_S 770 // %1!%r! operation completed successfully.
+#define MIR_FAIL_READ_STRUCTURE 771 // Unable to read structure.
+#define MIR_FAIL_RELEASE_RESOURCE 772 // Failed to release the resource.
+#define MIR_MERGE_PREPROC_INPUT_GRIDS 773 // Pre-processing input rasters to merge...
+#define MIR_MERGE_PREPROC_S 774 // Pre-processing raster %1!%r!
+#define MIR_MERGE_INCOMPATIBLE_FIELDTYPE_S 775 // Incompatible Field type detected in the source raster %1!%r!.
+#define MIR_MERGE_INCOMPATIBLE_BANDCOUNT_S 776 // Incompatible Band count detected in the source raster %1!%r!.
+#define MIR_MERGE_INCOMPATIBLE_CORDSYS_S 777 // Incompatible coordinate system detected in the source raster %1!%r!.
+#define MIR_MERGE_MRT_NONSQUARE_CELL_S 778 // Non-square cells are not supported for multi-resolution output. Choose a source raster with square cells %1!%r!.
+#define MIR_MERGE_PREPROC_UPDATE_S 779 // Merge pre-processing %1!%r!% complete.
+#define MIR_MERGERECT_NO_OVERLAP 780 // No overlap found between merge rectangle and the union of input rasters' bound.
+#define MIR_MERGE_PREPROC_COMPLETE 781 // Merge pre-processing of input rasters completed.
+#define MIR_MERGE_STARTED 782 // Merge operation started.
+#define MIR_MERGE_PROC_UPDATE_S 783 // Merge data processing %1!%r!% completed.
+#define MIR_MERGE_COMPLETED 784 // Merge operation completed successfully.
+#define MIR_GET_INTERP_BLOCK_FAILED 785 // Failed to interpolate data block.
+#define MIR_CSYS_NULL 786 // CSYS is Null in Input vector and raster.
+#define MIR_DUP_COLNAME 787 // Column name should be unique. %1!%r! column name exists in input TAB or input column list
+#define MIR_BAD_COLNAME 788 // Column name:%1!%r!, doesn't exists in input TAB
+#define MIR_INVALID_COLNAME 789 // Invalid Column name: %1!%r!. Column name should not be more than 30 char with no spaces and special char.
+#define MIR_COL_DATATYPE_NOT_ALLOWED 790 // %1!%r! column data type is incompatible with band data type or the null/no cell values
+#define MIR_VECTOR_MODIFY_FAIL 791 // Vector file modification failure.
+#define MIR_COLINFO_NULL 792 // Output TAB column info is Null
+#define MIR_MISSING_COLINFO 793 // Missing Column info. Output TAB column info should be given for all input raster
+#define MIR_INVALID_DEST 794 // Incorrect destination TAB path
+#define MIR_POINT_INSPECTION_START 795 // Point Inspection operation started.
+#define MIR_XYBLOCK_COUNT_D_D 796 // Running operation on total %1!%r! XBlocks %2!%r! YBlocks.
+#define MIR_BLOCK_SIZE_G_G_G_G 797 // Current block size dMinX=%1!%g! dMaxX=%2!%g! dMinY=%3!%g! dMaxY=%4!%g!.
+#define MIR_READ_OBJECTS_VECTOR_S 798 // Reading objects from input vector file %1!%r!.
+#define MIR_READ_CELLVALUE_RASTER_VECTOR_S 799 // Reading cell values from input raster %1!%r!.
+#define MIR_MODIFY_RECORDS_VECTOR 800 // Modifying records in output vector.
+#define MIR_POINT_INSPECTION_COMPLETED 801 // Point Inspection operation completed successfully.
+#define MIR_PROCESSING_TASK1 802 // Input source file path: %1!%r!.
+#define MIR_PROCESSING_TASK2 803 // Output file path: %1!%r!.
+#define MIR_PROCESSING_TASK3 804 // Destination driver string: %1!%r!.
+#define MIR_PROCESSING_TASK4 805 // Finalize options delete: %1!%r! Discard: %2!%r! BuildOverViews: %3!%r! ComputeStats %4!%r!, StatsLevel %5!%r!.
+#define MIR_PROCESSING_TASK5 806 // Operation going to be performed: %1!%r!.
+#define MIR_REPROJECT_ERR_INPUT_COORDSYS_NOT_FOUND 807 // Input raster can not be re-projected, no coordinate system found in input raster.
+#define MIR_INVALID_PROJECTION_COMBINATION 808 // The selected projection/reprojection combination is not valid for this data.
+#define MIR_REPROJECT1 809 // Source raster CoordSys: [%1!%r!].
+#define MIR_REPROJECT2 810 // Destination raster requested CoordSys: [%1!%r!].
+#define MIR_REPROJECT3 811 // OldMinX: %1!%g! OldMinY: %2!%g! OldMaxX: %3!%g! OldMaxY: %4!%g!.
+#define MIR_REPROJECT4 812 // NewCellSize: %1!%g! nNewColumns: %2!%r! nNewRows: %3!%r! NewMinX: %4!%g! NewMinY: %5!%g! NewMaxX: %6!%g! NewMaxY: %7!%g!.
+#define MIR_REPROJECT_STARTING 813 // Reproject operation started.
+#define MIR_REPROJECT_COMPLETE_S 814 // Reprojecting %1!%r!% complete.
+#define MIR_REPROJECT_COMPLETED 815 // Reproject operation completed successfully.
+#define MIR_RESAMPLE_COMPLETE_S 816 // Resampling %1!%r!% complete.
+#define MIR_RESAMPLE_STARTED 817 // Resample operation started.
+#define MIR_RESAMPLE_COMPLETED 818 // Resample operation completed successfully.
+#define MIR_SLOPE_STARTED 819 // Slope operation started.
+#define MIR_SLOPE_COMPLETE_S 820 // Slope %1!%r!% complete.
+#define MIR_SLOPE_COMPLETED 821 // Slope operation completed successfully.
+#define MIR_ASPECT_STARTED 822 // Aspect operation started.
+#define MIR_ASPECT_COMPLETE_S 823 // Aspect %1!%r!% complete.
+#define MIR_ASPECT_COMPLETED 824 // Aspect operation completed successfully.
+#define MIR_CURVATURE_STARTED 825 // Curvature operation started.
+#define MIR_CURVATURE_COMPLETE_S 826 // Curvature %1!%r!% complete.
+#define MIR_CURVATURE_COMPLETED 827 // Curvature operation completed successfully.
+#define MIR_VEC_FIELD_TYPE_NOTSUPPORTED 828 // Vector field type is not supported by this operation.
+#define MIR_INVALID_VEC_FIELD_INDEX 829 // Invalid vector field index.
+#define MIR_VECTORTOGRID_INVALID_FOREGROUNDTYPE 830 // Incompatible foreground value type specified.
+#define MIR_VEC2GRID_PREPROC_INPUT_VECTOR 831 // Pre-processing input vector file...
+#define MIR_VEC2GRID_PREPROC_COMPLETED 832 // Completed pre-processing input vector file.
+#define MIR_VEC2GRID_STARTED 833 // Rasterize operation started.
+#define MIR_VEC2GRID_PROC_UPDATE_S 834 // Rasterize processing %1!%r!% complete..
+#define MIR_VEC2GRID_COMPLETED 835 // Rasterize operation completed successfully.
+#define MIR_VECTOR_TO_GRID1 836 // Start Load %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID2 837 // End Load %1!%r!/%2!%r! : %3!%r!
+#define MIR_VECTOR_TO_GRID3 838 // Start Process %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID4 839 // End Process %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID5 840 // Start Block Write %1!%r!/%2!%r! : %3!%r!
+#define MIR_VECTOR_TO_GRID6 841 // End Block Write %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID7 842 // End Load %1!%r!/%2!%r! : %3!%r! %4!%r!
+#define MIR_VECTOR_TO_GRID8 843 // Starting Chunk %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID9 844 // Chunk size %1!%r!/%2!%r! :
+#define MIR_VECTOR_TO_GRID10 845 // Failed AddPoly %1!%r! :
+#define MIR_VECTOR_TO_GRID11 846 // Failed Process %1!%r! :
+#define MIR_VECTOR_TO_GRID12 847 // Succeed Process %1!%r!/%2!%r! : %3!%r!/%4!%r!
+#define MIR_VECTORTOGRID_NO_GEOMS_FOUND 848 // No supported geometry found to rasterize.
+#define MIR_INVALID_FILE 849 // Unable to verify file.
+#define MIR_VIEWSHED_INVALID_RADIUS 850 // Viewshed radius must be greater than or equal to cell size.
+#define MIR_VIEWSHED_INVALID_VIEWPOINTHEIGHT 851 // Viewpoint height must be positive.
+#define MIR_VIEWSHED_INVALID_SWEEP 852 // Invalid sweep angle/azimuth parameters
+#define MIR_VIEWSHED_INVALID_FILTER 853 // Invalid viewshed filter size.
+#define MIR_VIEWSHED_INVALID_CLASSIFICATION 854 // Invalid viewshed classification.
+#define MIR_VIEWSHED_INVALID_EARTHCURVATURE 855 // Invalid viewshed earth curvature.
+#define MIR_VIEWSHED_INVALID_TOWER_AREA 856 // Invalid viewshed tower area. Check coordinate systems.
+#define MIR_VIEWSHED_COMPLEX_CALC_NOT_SUPPORTED_FOR_MULTI_TILE_RASTERS 857 // The viewshed complex calculation option is not supported for multi-tile rasters.
+#define MIR_GENERATING_VIEWSHED 858 // Viewshed operation started.
+#define MIR_VIEWSHED_ORIGIN_IS_NOT_OVER_A_VALID_CELL 859 // Viewshed origin is not over a valid cell, so height cannot be determined.
+#define MIR_VIEWSHED_COMPLETE_S 860 // Viewshed %1!%r!% complete.
+#define MIR_VIEWSHED_WRITING_UNPROCESSED_TILES 861 // Writing unprocessed tiles.
+#define MIR_VIEWSHED_COMPLETED 862 // Viewshed operation completed successfully.
+#define MIR_TABLE_ACCESS_ERROR 863 // An error occurred accessing the table.
+#define MIR_HORIZONTAL_UNIT_MISMATCH 864 // Raster's horizontal unit code must be same.
+#define MIR_VERTICAL_UNIT_MISMATCH 865 // Raster's vertical unit code must be same.
+#define MIR_VOLUME_OUTPUT_UNIT_UNDEFINED 866 // Not able to deduce the output unit, define a valid output unit.
+#define MIR_VOLUME_PLANE_D 867 // Computing Volume of the raster against constant plane %1!%f!.
+#define MIR_VOLUME_SECONDARY_RASTER_S 868 // Computing Volume of the raster against secondary raster %1!%r!.
+#define MIR_RASTERVOLUME_OPERATION_NAME 869 // Raster volume
+#define MIR_VOLUME_OUTPUT 870 // Computed volume is %1!%.4f! and cell count is %2!%r!.
+#define MIR_XSection_DISTANCE_LT_BASERES 871 // Warning: Calculated distance between points is less than the base resolution cell size.
+#define MIR_XSection_DISTANCE_SAMPLES_F_D 872 // Computing cross section with %1!%f! distance between points and %2!%r! total samples ...
+#define MIR_CROSS_SECTION_START 873 // Cross Section operation started.
+#define MIR_COMPUTE_XSECTION 874 // Computing cross section for all lines...
+#define MIR_START_CREATE_VECTOR_FILE_S 875 // Start creating %1!%r! output vector file.
+#define MIR_END_CREATE_VECTOR_FILE 876 // Vector file creation completed.
+#define MIR_XSECTION_COMPLETED 877 // Cross Section operation completed successfully.
+#define MIR_ONLY_CONTINOUS_CLASSIFIED_IMAGE_SUPPORTED 878 // Field type is not valid, only Continuous, Classified and Image fields allowed.
+#define MIR_INPUT_VECTOR 879 // Input vector File Path: %1!%r!.
+#define MIR_INPUT_SOURCE 880 // Input Source File Path [%1!%r!]: %2!%r!.
+#define MIR_OUTPUT_VECTOR 881 // Output vector File Path: %1!%r!.
+#define MIR_OPERATION_PERFORMED 882 // Operation going to be performed: %1!%r!.
+#define MIR_REGION_INSPECTION_START 883 // Region Inspection operation started.
+#define MIR_NO_POLYGON_OBJECTS_FOUND 884 // No polygon objects found in Input vector file.
+#define MIR_BEGIN_REGION_INSPECTION 885 // Region inspection started for %1!%r!
+#define MIR_END_REGION_INSPECTION 886 // Region inspection completed for %1!%r!.
+#define MIR_REGION_INSPECTION_COMPLETED 887 // Region Inspection operation completed successfully.
+#define MIR_BEGIN_GRID_REGION_INSPECTION 888 // Begin region inspection %1!%r!
+#define MIR_END_GRID_REGION_INSPECTION 889 // End region inspection %1!%r!
+#define MIR_BEGION_REGION_STATS_COMPUTE 890 // Begin region statistics computation %1!%r!
+#define MIR_END_REGION_STATS_COMPUTE 891 // End region statistics computation %1!%r!
+#define MIR_INVALID_BIN_COUNT 892 // Invalid Number of Bins specified.
+#define MIR_INVALID_CLASSIFICATION_TYPE 893 // Invalid classification type. Reclassify operation not allowed.
+#define MIR_REQD_CLASS_NAME_MISSING 894 // Required class name missing from input or output classification info.
+#define MIR_INVALID_CLASS_VALUE 895 // Output class value is out of range. Maximum allowed value is 65535.
+#define MIR_INVALID_CLASSIFICATION_RANGE 896 // The classification info range is incorrect, lower bound greater than or equal to upper bound.
+#define MIR_FAIL_CLASSIFY 897 // Failed to classify grid.
+#define MIR_INVALID_CLASSIFICATION_RANGE_OVERLAP 898 // The classification ranges are overlapping.
+#define MIR_CLASSIFY_STARTED 899 // Classify operation started.
+#define MIR_CLASSIFY_COMPLETE_S 900 // Classifying %1!%r!% complete.
+#define MIR_CLASSIFY_COMPLETE 901 // Classify operation completed successfully.
+#define MIR_DUPLICATE_CLASS_VALUE 902 // Duplicate input class value are not allowed.
+#define MIR_COMPUTE_STATS_COMPLETE_S 903 // Computing statistics %1!%r!% completed.
+#define MIR_Align_Incompatible 904 // Input raster is incompatible to align with primary raster.
+#define MIR_RES_INSIDE 905 // Visible
+#define MIR_RES_OUTSIDE 906 // Invisible
+#define MIR_RES_FRINGE 907 // Fringe
+#define MIR_RES_TRUE 908 // True
+#define MIR_RES_FALSE 909 // False
+#define MIR_RES_NULL 910 // Null
+#define MIR_RES_OFFGRID 911 // Off Raster
+#define MIR_RES_POINTS 912 // point
+#define MIR_RES_LINE 913 // lines
+#define MIR_RES_REGIONS 914 // region
+#define MIR_RES_NOCELL 915 // No Cell
+#define MIR_RES_INVALID 916 // Invalid
+#define MIR_RES_VISIBLE 917 // Visible
+#define MIR_RES_DISTANCE 918 // Distance
+#define MIR_RES_OFFSETREQUIRED 919 // OffsetRequired
+#define MIR_RES_NUM_VISIBLE 920 // NumVisible
+#define MIR_RES_XML_READ_FAIL 921 // XMLReadFail
+#define MINT_RRENDER_NOLAYERTYPE 922 // Rendering failure. A layer has no defined type.
+#define MINT_RRENDER_NOCOMPTYPE 923 // Rendering failure. A component has no defined type.
+#define MINT_RRENDER_ALGINVALID 924 // Rendering failure. The algorithm has been incorrectly defined.
+#define MINT_RRENDER_ALGFAIL 925 // Rendering failure. The algorithm failed.
+#define MINT_RENDER_FAIL_BADSCENE 984 // Rendering failure. Bad scene parameters supplied.
+#define MINT_RENDER_FAIL_BADCOLORTYPE 985 // Rendering failure. Bad color type supplied.
+#define MINT_RENDER_FAIL_NOCONTEXT 986 // Rendering failure. Rendering context is invalid or does not exist.
+#define MINT_RENDER_FAIL_BADBUFFER 987 // Rendering failure. Bad memory buffer supplied.
+#define MINT_RENDER_FAIL_ALGDISABLED 988 // Rendering failure. The algorithm is disabled.
+#define MINT_ALGBLD_FAIL_XMLENCODE 972 // Failed to encode information to XML.
+#define MINT_ALGBLD_FAIL_NOALG 973 // Error. No algorithm defined.
+#define MINT_ALGBLD_FAIL_NOLAY 974 // Error. No layer defined.
+#define MINT_ALGBLD_FAIL_NOCPT 975 // Error. No component defined.
+#define MINT_ALGBLD_FAIL_NORASSRC 976 // Error. No raster source defined.
+#define MINT_ALGBLD_FAIL_NOCOLTAB 977 // Error. No color table defined.
+#define MINT_ALGBLD_FAIL_NODATTRAN 978 // Error. No data transform defined.
+#define MINT_ALGBLD_FAIL_NOCOLDATCOND 979 // Error. No data conditioning defined.
+#define MINT_ALGBLD_FAIL_NORASSRCFILE 980 // Error. Invalid file index.
+#define MINT_ALGBLD_FAIL_NOCOLTABCOL 981 // Error. Invalid color index.
+#define MINT_ALGBLD_FAIL_NODATTRANIND 982 // Error. Invalid data index.
+#define MINT_ALGBLD_FAIL_NOCOLDATCONDIND 983 // Error. Invalid data index.
+#define MINT_ALGBLD_FAIL_GHX 989 // Error. Could not interpret the GHX file.
+#define MINT_ALGBLD_FAIL_BADLAYTYPE 990 // Error. Layer type is not defined.
+#define MINT_ALGBLD_FAIL_BADCMPTYPE 992 // Error. Component type is not defined.
+#define MINT_ALGBLD_FAIL_NOLAYER 991 // Error. No renderable layers are defined.
+#define MIR_RESP_COLNAME_VALIDATE_FAIL 957 // Column name validation failed, column name should be unique.
+#define MIR_POLYGONISE_IMAGERY_NOT_SUPORTED 958 // Imagery field type is not supported for the selected polygonise mode.
+#define MIR_DUPLICATE_CLASS_VALUE_COLOR 959 // Output class values should have unique color values.
+#define MINT_SUGGESTINFO_FAIL 960 // Unable to Suggest Raster Info for provided inputs.
+#define MINT_DRIVERFAILEDWARPREQUIRED 926 // Driver failed because a warp is required.
+#define MINT_WARP_FAILCONTROLPNTS 961 // Warp failed. An insufficient number of control points were supplied.
+#define MINT_WARP_FAILDRIVERIMAGE 962 // Warp failed. The raster driver does not support Image fields.
+#define MINT_WARP_FAILTRANSFORM 963 // Warp failed. The warp could not be performed.
+#define MIR_COLNAME_NOT_EXIST 965 // Column not found, column name should pre-exist in the input TAB.
+#define MIR_COLUMN_DATATYPE_MISMATCH 966 // Input TAB Column datatype not compatible with raster data type.
+#define MIR_RACLASSIFY_WARNTABLEBANDCOUNT 967 // Warning: The number of declared bands (%1!%r!) in the classification table does not match the expected band count (%2!%r!).
+#define MIR_RACLASSIFY_WARNTABLEROWCOUNT 968 // Warning: The number of declared rows (%1!%r!) in the classification table does not match the expected row count (%2!%r!).
+#define MIR_GRIDOP_IMPORTMRRPNT 969 // Gridding: Import to point cache.
+#define MIR_GRIDOP_IMPORTVALIDSTATIONCOUNT 970 // Imported a total of %1!%r! valid stations.
+#define MIR_INTERP_CANOPYDENSITY 993 // Gridding: Canopy Density.
+#define MIR_INTERP_CANOPYHEIGHT 994 // Gridding: Canopy Height.
+#define MIR_INTERP_CANOPYCOVERAGE 995 // Gridding: Canopy Coverage.
+#define MIR_LIDAR_CLASSRULEINVALID 996 // Error. Classification rule does not match supplied inputs.
+#define MIR_AUTOFLOODEDIT_STARTED 997 // Automated flood edit operation started.
+#define MIR_ITERATOR_INVALID 998 // Error: Iterator is not in a valid state.
+#define MIR_ITERATOR_FINISHED 999 // Iterator has completed.
+#define MIR_ITERATOR_NOTILE 1000 // Error: Iterator failed to acquire a tile.
+#define MINT_SATIMPORT_INVALIDFILENAME 1001 // Error: The supplied filename is not interpretable.
+#define MINT_SATIMPORT_UNKNOWNSATELLITE 1002 // Error: The supplied filename refers to an unknown satellite.
+#define MINT_SATIMPORT_UNKNOWNSENSOR 1003 // Error: The supplied filename refers to an unknown sensor.
+#define MINT_SATIMPORT_MTLGROUPORDER 1004 // Error: The MTL file groups are out of order.
+#define MINT_SATIMPORT_UNSUPPORTEDSATELLITE 1005 // Error: The satellite platform is not supported.
+#define MINT_SATIMPORT_INVALIDMETADATA 1006 // Error: The metadata was not interpretable.
+#define MINT_SATIMPORT_UNSUPPORTEDCOLLECTION 1007 // Error: The processing collection is not supported.
+
+//
+// Dictionary CUSRDMutable
+//
+// Do not manually edit this file. It should be re-generated, when required, by running MakeAPICodes.exe.
+// This program will also re-generate RasterDictionary.xml.
+//
+// New error codes should be added to m_vvDictionary in MINTSystem.cpp
+//
+
diff --git a/gdal/frmts/mrr/APIDef.h b/gdal/frmts/mrr/APIDef.h
new file mode 100644
index 000000000000..3398918d9c40
--- /dev/null
+++ b/gdal/frmts/mrr/APIDef.h
@@ -0,0 +1,3006 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+/*!\file APIDEF.h
+ \brief MapInfo Pro Raster C-API header definitions.
+
+ This file contains definitions used by the MapInfo Pro Raster API.
+*/
+
+#ifndef APIDEF_H
+#define APIDEF_H
+
+#pragma once
+
+#include
+#ifdef __linux__
+#include
+#endif
+#include "APICodes.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*****************************************************************************************************************************/
+// Constants
+
+typedef int32_t MIRResult; //!> Result code returned by API functions
+
+static const int32_t MIRSuccess = 0; //!< Indicates successful result for an operation
+static const uint32_t MIRInvalidHandle = UINT32_MAX; //!< Default value of an invalid resource handle
+static const uint32_t InvalidTracker = 0u; //!< Indicates no tracker is supplied to an operation
+static const uint32_t InvalidBand = UINT32_MAX; //!< Indicates no band index is supplied to an operation
+static const size_t MAX_FILEPATH = 256u; //!< Maximum number of chars in the file path
+static const size_t MAX_COORDSYS = 512u; //!< Maximum number of coordinate system objects
+static const uint32_t DefaultSampleCount = 100u; //!< Default number of samples to be created along a line
+static const double DefaultNullValue = -9999.0; //!< Default null value for legacy rasters
+static const uint32_t DefaultExportMaxDecimal = 16u; //!< Default number of decimal points written on export
+static const wchar_t DefaultExportDelimiter = L' '; //!< Default Delimiter used in export
+static const uint32_t InvalidBinCount = UINT32_MAX; //!< Indicates no bin count is supplied to an operation
+static const uint32_t InvalidColor = 0xFEFFFFFF; //!< Indicates no color is supplied to this operation
+static const uint32_t MaxGroupCount = 1024; //!< Default maximum number of groups ro return
+
+/*****************************************************************************************************************************/
+// General enumerations
+
+/*! \enum MIR_DataType
+ \brief Data types representable by a variant.
+
+ MIR_DATETIME_OLE
+ The DATE type is implemented using an 8-byte floating-point number.
+ Days are represented by whole number increments starting with 30 December 1899, midnight as time zero.
+ Hour values are expressed as the absolute value of the fractional part of the number.
+ The DATE date type represents dates and times as a classic number line.
+ The DATE timeline becomes discontinuous for date values less than 0 (before 30 December 1899).
+ This is because the whole-number portion of the date value is treated as signed, while the fractional part is treated as
+ unsigned. In other words, the whole-number part of the date value may be positive or negative, while the fractional part
+ of the date value is always added to the overall logical date.
+
+ MIR_DATETIME_CPP
+ The number of seconds since January 1, 1970, 0:00 UTC.
+*/
+enum MIR_DataType
+{
+ // Invalid
+ MIR_UNDEFINED = 0, //!< Undefined data type
+ MIR_NULL, //!< Null data type
+ MIR_EMPTY, //!< Empty data type
+ // Boolean
+ MIR_BOOLEAN_INT8 = 10, //!< 8-bit boolean type
+ MIR_BOOLEAN_INT32, //!< 32-bit boolean type
+ // Bit
+ MIR_BIT1 = 20, //!< 1-bit data
+ MIR_BIT2, //!< 2-bit crumb
+ MIR_BIT4, //!< 4-bit nibble
+ // Unsigned integers
+ MIR_UNSIGNED_INT8 = 30, //!< 8-bit unsigned integer
+ MIR_UNSIGNED_INT16, //!< 16-bit unsigned integer
+ MIR_UNSIGNED_INT32, //!< 32-bit unsigned integer
+ MIR_UNSIGNED_INT64, //!< 64-bit unsigned integer
+ // Signed integers
+ MIR_SIGNED_INT8 = 40, //!< 8-bit signed integer
+ MIR_SIGNED_INT16, //!< 16-bit signed integer
+ MIR_SIGNED_INT32, //!< 32-bit signed integer
+ MIR_SIGNED_INT64, //!< 64-bit signed integer
+ // Floating point
+ MIR_REAL2 = 50, //!< 2 byte real (unimplemented)
+ MIR_REAL4, //!< 4 byte real
+ MIR_REAL8, //!< 8 byte real
+ MIR_REAL_LONG, //!< 8 byte real
+ // Complex numbers
+ MIR_COMPLEX_INT16 = 60, //!< 16-bit signed integer complex number (real, imaginary)
+ MIR_COMPLEX_INT32, //!< 32-bit signed integer complex number (real, imaginary)
+ MIR_COMPLEX_REAL4, //!< 4 byte real complex number (real, imaginary)
+ MIR_COMPLEX_REAL8, //!< 8 byte real complex number (real, imaginary)
+ // Time - Date
+ MIR_DATETIME_OLE = 70, //!< Windows DATE, 8 byte real
+ MIR_DATETIME_CPP, //!< Standard time_t, 64 bit integer
+ // String
+ MIR_STRING = 80, //!< ASCII, variable length
+ MIR_FIXED_STRING, //!< ASCII, Fixed length
+ MIR_STRING_UTF8, //!< Unicode, variable length, std::string
+ MIR_STRING_UTF16, //!< Unicode, variable length, std::wstring
+ MIR_STRING_UTF32, //!< Unicode, variable length, std::u32string
+ // Binary large objects
+ MIR_BINARY_OBJECT = 90, //!< Variable length
+ MIR_FIXED_BINARY_OBJECT, //!< Fixed length
+ // Color
+ MIR_RED = 100, //!< 8 bit red
+ MIR_GREEN, //!< 8 bit green
+ MIR_BLUE, //!< 8 bit blue
+ MIR_GREY, //!< 8 bit grey (minimum is black)
+ MIR_ALPHA, //!< 8 bit opacity, (minimum is transparent)
+ MIR_RED_ALPHA, //!< 8|8 bit
+ MIR_GREEN_ALPHA, //!< 8|8 bit
+ MIR_BLUE_ALPHA, //!< 8|8 bit
+ MIR_GREY_ALPHA, //!< 8|8 bit
+ MIR_RGB, //!< 8|8|8 bit
+ MIR_RGBA, //!< 8|8|8|8 bit
+ MIR_BGR, //!< 8|8|8 bit
+ MIR_BGRA, //!< 8|8|8|8 bit
+ MIR_HSI_Hue, //!< 8 bit hue (HSI)
+ MIR_HSI_Saturation, //!< 8 bit saturation (HSI)
+ MIR_HSI_Intensity, //!< 8 bit intensity (HSI)
+ MIR_HSL_Hue, //!< 8 bit hue (HSL/HLS)
+ MIR_HSL_Saturation, //!< 8 bit saturation (HSL/HLS)
+ MIR_HSL_Lightness, //!< 8 bit lightness (HSL/HLS)
+ MIR_HSV_Hue, //!< 8 bit hue (HSV/HSB)
+ MIR_HSV_Saturation, //!< 8 bit saturation (HSV/HSB)
+ MIR_HSV_Value, //!< 8 bit value (HSV/HSB)
+ MIR_HSI, //!< 8|8|8 bit
+ MIR_HSL, //!< 8|8|8 bit
+ MIR_HSV, //!< 8|8|8 bit
+ MIR_HSIA, //!< 8|8|8|8 bit
+ MIR_HSLA, //!< 8|8|8|8 bit
+ MIR_HSVA, //!< 8|8|8|8 bit
+ MIR_MINISBLACK1, //!< 1 bit grey (minimum is black)
+ MIR_MINISBLACK2, //!< 2 bit grey (minimum is black)
+ MIR_MINISBLACK4, //!< 4 bit grey (minimum is black)
+ MIR_MINISBLACK8, //!< 8 bit grey (minimum is black)
+ MIR_MINISWHITE1, //!< 1 bit grey (minimum is white)
+ MIR_MINISWHITE2, //!< 2 bit grey (minimum is white)
+ MIR_MINISWHITE4, //!< 4 bit grey (minimum is white)
+ MIR_MINISWHITE8 //!< 8 bit grey (minimum is white)
+};
+
+/*! \enum MIR_UnitCode
+ \brief MapInfo units.
+*/
+enum MIR_UnitCode
+{
+ MIR_Undefined = -1, //!< Undefined Unit Type
+ MIR_Miles = 0, //!< MapInfo Unit Type - Miles
+ MIR_Kilometers = 1, //!< MapInfo Unit Type - Kilometres
+ MIR_Inches, //!< MapInfo Unit Type - Inches
+ MIR_Feet, //!< MapInfo Unit Type - Feet
+ MIR_Yards, //!< MapInfo Unit Type - Yards
+ MIR_Millimeters, //!< MapInfo Unit Type - Millimeters
+ MIR_Centimeters, //!< MapInfo Unit Type - Centimeters
+ MIR_Meters, //!< MapInfo Unit Type - Meters
+ MIR_USSurveyFeet, //!< MapInfo Unit Type - US Survey Feet
+ MIR_NauticalMiles, //!< MapInfo Unit Type - Nautical Miles
+ MIR_Links = 30, //!< MapInfo Unit Type - Links
+ MIR_Chains = 31, //!< MapInfo Unit Type - Chains
+ MIR_Rods = 32, //!< MapInfo Unit Type - Rods
+ MIR_Degree = 64, //!< MapInfo Unit Type - Degree
+ MIR_ArcMinute = 65, //!< MapInfo Unit Type - Arc Minute
+ MIR_ArcSecond = 66, //!< MapInfo Unit Type - Arc Second
+ MIR_MilliArcSecond = 67, //!< MapInfo Unit Type - Milli Arc Second
+
+ MIR_Microseconds = 100,
+ MIR_Milliseconds,
+ MIR_Seconds,
+ MIR_Minutes,
+ MIR_Hours,
+ MIR_Days,
+ MIR_Weeks,
+ MIR_Years,
+
+ MIR_dB = 128,
+ MIR_dBm,
+ MIR_dBW,
+ MIR_dBuV_m,
+ MIR_Radians,
+ MIR_Percent,
+ MIR_DegreeDBP,
+ MIR_Calls_HR_KM2,
+ MIR_Msgs_HR_KM2,
+ MIR_Erlangs_HR_KM2,
+ MIR_SimCalls_KM2,
+
+ MIR_Erlang = 140,
+ MIR_Bits_Cell,
+ MIR_KBits_KM2,
+ MIR_MBits_KM2,
+ MIR_Events_Sec,
+ MIR_Kbps,
+ MIR_Kbps_KM2_Floor,
+ MIR_Subscribers,
+ MIR_Subscribers_KM2,
+ MIR_Subscribers_KM2_Floor,
+ MIR_Erlangs_KM2,
+ MIR_Erlangs_KM2_Floor,
+ MIR_Mbps,
+ MIR_Bits_S_Hz,
+ MIR_Kbps_KM2,
+ MIR_Kbps_MHz,
+ MIR_Calls,
+
+ MIR_Kilometres = MIR_Kilometers,
+ MIR_Millimetres = MIR_Millimeters,
+ MIR_Centimetres = MIR_Centimeters,
+ MIR_Metres = MIR_Meters,
+ MIR_Degrees = MIR_Degree
+};
+
+/*****************************************************************************************************************************/
+// Vehicles, drivers and driver capabilities
+
+/*! \struct SMIR_VehicleCapabilities
+ \brief Capabilities of the vehicle, applicable to all drivers it supports.
+*/
+struct SMIR_VehicleCapabilities
+{
+ char sUniqueID[256];
+ uint32_t nIdentificationStrength;
+
+ wchar_t sName[256];
+ wchar_t sDescription[256];
+
+ uint32_t bMultipleDriver : 1; //!< Supports multiple drivers
+ uint32_t bThreadSafeNative : 1; //!< Supports multiple thread access in Native support mode (ReadOnly & EditCell)
+ uint32_t bThreadSafeBase : 1; //!< Supports multiple thread access in Base support mode (ReadOnly & EditCell)
+ uint32_t bThreadSafeFull : 1; //!< Supports multiple thread access in Full support mode (ReadOnly & EditCell)
+};
+
+/*! \struct SMIR_DriverCapabilities
+ \brief Capabilities of a driver.
+*/
+struct SMIR_DriverCapabilities
+{
+ char sUniqueID[256];
+ uint32_t nIdentificationStrength;
+
+ wchar_t sName[256];
+ wchar_t sDescription[256];
+
+ wchar_t sExtension[32];
+ wchar_t sExtensionList[256];
+
+ // Support for fields, bands and events
+ uint32_t bMultipleField : 1; //!< Supports multiple unrelated fields
+ uint32_t bMultipleBand : 1; //!< Supports multi-banded fields
+ uint32_t bMultipleEvent : 1; //!< Supports the time dimension
+
+ // Support for field types
+ uint32_t bClassifiedField : 1; //!< Supports classified field type
+ uint32_t bImageField : 1; //!< Supports image field type
+ uint32_t bImagePaletteField : 1; //!< Supports image palette field type
+ uint32_t bContinuousField : 1; //!< Supports continuous field type
+
+ // Support for operations
+ uint32_t bEditCell : 1; //!< Supports edit cell operation
+ uint32_t bEditStructure : 1; //!< Supports edit operation: extension of the raster structure
+ uint32_t bCreate : 1; //!< Supports create operation
+
+ // Support for tile access
+ uint32_t bRandomRead : 1; //!< Supports random access for reading a tile
+ uint32_t bRandomWrite : 1; //!< Supports random access for writing a tile
+ uint32_t nLoadBandOnDemand : 2; //!< Supports loading bands on demand
+
+ // Support for overviews and statistics
+ uint32_t bStoredOverviews : 1; //!< Supports overviews stored in the raster file
+ uint32_t bSuppliesUnderviews : 1; //!< Supports underviews acquired from the driver
+ uint32_t bRequireStoreOverview : 1; //!< Writing overviews may be optional or required
+ uint32_t bAllowPermanentCache : 1; //!< Allow a permanent full or partial pyramid cache to be created as a raster companion file
+ uint32_t nPriorWriteStatistics : 3; //!< Requires statistics prior to writing
+ //!< 0 = None, 1 = Count, 2 = Summary, 3 = Distribution, 4 = Spatial
+ uint32_t nStoreWriteStatistics : 3; //!< Supports statistics stored in the raster file
+ //!< 0 = None, 1 = Count, 2 = Summary, 3 = Distribution, 4 = Spatial
+ uint32_t bRequireStoreStatistics : 1; //!< Writing statistics may be optional or required
+
+ uint32_t bVariableCellExtent : 1; //!< Supports extendable and modifiable cell count
+ uint32_t bSparseTiles : 1; //!< Supports sparse tile arrangements
+
+ uint32_t bFixedAnchor : 1; //!< Global anchor position for cell (0,0) in any level
+ uint32_t bPower2CellSize : 1; //!< Cell size varies by 2 for each level
+ uint32_t bDataASCII : 1; //!< Raster data file is ASCII format
+ uint32_t nCellValidityMethod : 2; //!< 0 = none,1 = numeric compare,2 = string compare,3 = mask
+ uint32_t bExtendedValidity : 1; //!< Supports invalid cell classification
+
+ // Data storage arrangement within the raster
+ // TODO Make this a mask of 4 bits to allow combinations.
+ uint32_t nCellArrangement_Storage : 2; //!< Cell/Row/Strip/Tile
+
+ // Order of tiles within the raster
+ uint32_t nCellArrangement_RasterXSense : 2; //!< W - E / E - W
+ uint32_t nCellArrangement_RasterYSense : 2; //!< S - N / N - S
+
+ // Order of cells within a tile
+ uint32_t nCellArrangement_TileXSense : 2; //!< W - E / E - W
+ uint32_t nCellArrangement_TileYSense : 2; //!< S - N / N - S
+
+ // The level at which fields are interleaved
+ uint32_t nCellArrangement_InterleaveField : 2; //!< Cell/Row/Tile/Raster
+
+ // The level at which bands are interleaved
+ uint32_t nCellArrangement_InterleaveBand : 2; //!< Cell/Row/Tile/Raster
+
+ uint32_t bThreadSafeNative : 1; //!< Supports multiple thread access in Native support mode (ReadOnly & EditCell)
+ uint32_t bThreadSafeBase : 1; //!< Supports multiple thread access in Base support mode (ReadOnly & EditCell)
+ uint32_t bThreadSafeFull : 1; //!< Supports multiple thread access in Full support mode (ReadOnly & EditCell)
+
+ uint32_t bCompression : 1; //!< Supports compression (methods not specified here)
+
+ uint32_t bFixedTableStructure : 1; //!< Supports fixed classification table structure
+ uint32_t nEndian : 2; //!< 0 = None, 1 = Little, 2 = Big, 3 = Little and Big
+};
+
+/*****************************************************************************************************************************/
+// Raster properties
+
+/*! \enum MIR_FieldType
+ \brief Raster field type.
+*/
+enum MIR_FieldType
+{
+ MIR_FIELD_Default = -1,
+ MIR_FIELD_Classified = 0,
+ MIR_FIELD_Image = 1,
+ MIR_FIELD_ImagePalette = 2,
+ MIR_FIELD_Continuous = 3
+};
+
+/*! \enum MIR_ClassTableFieldType
+ \brief Raster classification table field type.
+*/
+enum MIR_ClassTableFieldType
+{
+ MIR_TFT_Undefined = -1, //!< Classified field type is undefined (system may define it appropriately)
+ MIR_TFT_Class = 0, //!< Classified field contains original class identifier
+ MIR_TFT_Value, //!< Classified field contains primary data value
+ MIR_TFT_Colour, //!< Classified field contains primary color value
+ MIR_TFT_Label, //!< Classified field contains primary text label
+ MIR_TFT_Data, //!< Classified field contains data
+ MIR_TFT_ColourR, //!< Classified field contains primary color red value
+ MIR_TFT_ColourG, //!< Classified field contains primary color green value
+ MIR_TFT_ColourB //!< Classified field contains primary color blue value
+};
+
+/*! \enum MIR_CompressionType
+ \brief Compression types supported by MIRaster IO API.
+*/
+enum MIR_CompressionType
+{
+ // MRR
+ MIR_NoCompression = -1, //!< No Compression. Compression Level is ignored.
+ MIR_Compression_Zip = 0, //!< Zip Compression. Supported compression Levels are 1 to 9.
+ MIR_Compression_LZMA = 1, //!< LZMA Compression. Supported compression Levels are 0 to 9.
+ MIR_Compression_PNG = 2, //!< PNG Compression.
+ MIR_Compression_JPEG = 3, //!< JPEG Compression. Supported compression Levels are 0+, maps to Quality 100-(3*C).
+ MIR_Compression_LZ4 = 4, //!< LZ4 high speed lossless compression.
+ //MIR_Compression_LZ4HC
+
+ //Grouped into Balanced, speed and space for data and imagery compression.
+ MIR_Compression_DataBalanced = 50, //!< Lossless data compression, balanced.
+ MIR_Compression_DataSpeed = 51, //!< Lossless data compression, favor higher encoding speed.
+ MIR_Compression_DataSpace = 52, //!< Lossless data compression, favor higher compression.
+ MIR_Compression_ImageBalanced = 53, //!< Lossless image compression, balanced.
+ MIR_Compression_ImageSpeed = 54, //!< Lossless image compression, favor higher encoding speed.
+ MIR_Compression_ImageSpace = 55, //!< Lossless image compression, favor higher compression.
+ MIR_Compression_ImageLossyBalanced = 56, //!< Lossy image compression, balanced.
+ MIR_Compression_ImageLossySpeed = 57, //!< Lossy image compression, favor higher encoding speed.
+ MIR_Compression_ImageLossySpace = 58, //!< Lossy image compression, favor higher compression.
+
+ // GeoTIFF
+ MIR_Compression_TIFF_NONE = 1000, //!< dump mode
+ MIR_Compression_TIFF_CCITTRLE = 1001, //!< CCITT modified Huffman RLE
+ MIR_Compression_TIFF_CCITTFAX3 = 1002, //!< CCITT Group 3 fax encoding
+ MIR_Compression_TIFF_T4 = 1003, //!< CCITT T.4 (TIFF 6 name)
+ MIR_Compression_TIFF_CCITTFAX4 = 1004, //!< CCITT Group 4 fax encoding
+ MIR_Compression_TIFF_CCITT_T6 = 1005, //!< CCITT T.6 (TIFF 6 name)
+ MIR_Compression_TIFF_LZW = 1006, //!< Lempel-Ziv & Welch
+ MIR_Compression_TIFF_OJPEG = 1007, //!< !6.0 JPEG
+ MIR_Compression_TIFF_JPEG = 1008, //!< %JPEG DCT compression
+ MIR_Compression_TIFF_ADOBE_DEFLATE = 1009, //!< Deflate compression,as recognized by Adobe
+ MIR_Compression_TIFF_T85 = 1010, //!< !TIFF/FX T.85 JBIG compression
+ MIR_Compression_TIFF_T43 = 1011, //!< !TIFF/FX T.43 colour by layered JBIG compression
+ MIR_Compression_TIFF_NEXT = 1012, //!< NeXT 2-bit RLE
+ MIR_Compression_TIFF_CCITTRLEW = 1013, //!< #1 w/ word alignment
+ MIR_Compression_TIFF_PACKBITS = 1014, //!< Macintosh RLE
+ MIR_Compression_TIFF_THUNDERSCAN = 1015, //!< ThunderScan RLE
+ MIR_Compression_TIFF_IT8CTPAD = 1016, //!< IT8 CT w/padding
+ MIR_Compression_TIFF_IT8LW = 1017, //!< IT8 Linework RLE
+ MIR_Compression_TIFF_IT8MP = 1018, //!< IT8 Monochrome picture
+ MIR_Compression_TIFF_IT8BL = 1019, //!< IT8 Binary line art
+ MIR_Compression_TIFF_PIXARFILM = 1020, //!< Pixar companded 10bit LZW
+ MIR_Compression_TIFF_PIXARLOG = 1021, //!< Pixar companded 11bit ZIP
+ MIR_Compression_TIFF_DEFLATE = 1022, //!< Deflate compression
+ MIR_Compression_TIFF_DCS = 1023, //!< Kodak DCS encoding
+ MIR_Compression_TIFF_JBIG = 1024, //!< ISO JBIG
+ MIR_Compression_TIFF_SGILOG = 1025, //!< SGI Log Luminance RLE
+ MIR_Compression_TIFF_SGILOG24 = 1026, //!< SGI Log 24-bit packed
+ MIR_Compression_TIFF_JP2000 = 1027, //!< Leadtools JPEG2000
+ MIR_Compression_TIFF_LZMA = 1028 //!< LZMA2
+};
+
+/*! \enum MIR_BandType
+ \brief Raster band type.
+*/
+enum MIR_BandType
+{
+ MIR_Concrete = 0, //!< Band data is stored in the raster
+ MIR_Component = 1, //!< Band data is an acquired component of another concrete band
+ MIR_TableField = 2, //!< Band data is acquired from a classification table field
+ MIR_TableField_Component = 3 //!< Band data is an acquired component of another band acquired from a classification table field
+};
+
+/*! \enum MIR_NULLType
+ \brief Raster null cell identification method.
+*/
+enum MIR_NULLType
+{
+ MIR_NULL_NONE = 0x00000001, // Specify one of these
+ MIR_NULL_NUMERIC_COMPARE = 0x00000002,
+ MIR_NULL_STRING_COMPARE = 0x00000004,
+ MIR_NULL_MASK = 0x00000008,
+ MIR_NULL_METHOD_FIXED = 0x00010000, // Optional
+ MIR_NULL_VALUE_FIXED = 0x00020000 // Optional
+};
+
+/*! \enum MIR_PredictiveEncoding
+ \brief Predictive encoding schemes.
+*/
+enum MIR_PredictiveEncoding
+{
+ MIR_Encoding_None = -1, /*!< No encoding.*/
+ MIR_PreviousColumnValue = 0, /*!< Predict the value from previous column.*/
+ MIR_PreviousColumnLinear = 1, /*!< Linear estimate the value from previous two columns.*/
+ MIR_RunLength = 2 /*!MIR_EventType. */
+
+ // User modifiable variable states
+ SMIR_EventInfoState DataState;
+};
+
+/*! \struct SMIR_BandInfoState
+ \brief Initial and final states for each band property.
+
+ When you create a raster you set an initial state for each property and after it has been created you can find out a final state for that property
+ (See the XQDO class in MINTSystem.h)
+
+ The initial state can be : Default (0), Request (1), or Require (2)
+ The Final state can be : OK (0), Warning (1), or Error (2)
+
+ The char arrays below correspond to Initial and Final state values.
+ If you "Request" a property and it is denied, you may receive a "Warning".
+ If you "Require" a property and it is denied, you may receive an "Error".
+*/
+struct SMIR_BandInfoState
+{
+ char nType[2];
+ char nName[2];
+ char nXMLMetaData[2];
+ char nUnitCode[2];
+ char nDataType[2];
+ char nStoreDataType[2];
+ char nDiscreteValue[2];
+ char nNullValueType[2],nNullValue[2];
+ char nRestrictDecimals[2],nMaxDecimals[2];
+ char nTransform[2],nScale[2],nOffset[2];
+ char nClip[2],nClipMin[2],nClipMax[2];
+ char nPredictiveEncoding[2];
+};
+
+/*! \struct SMIR_BandInfo
+ \brief Structure for defining the composition of a band in a raster.
+*/
+struct SMIR_BandInfo
+{
+ MIR_BandType nType; /*!< The type of band in the source raster as defined in \link MIR_BandType \endlink. */
+ wchar_t sName[256]; /*!< The name of the band. */
+ wchar_t sXMLMetaData[4096]; /*!< The band metadata. */
+
+ MIR_UnitCode nUnitCode; /*!MIR_FieldType. */
+ wchar_t sName[256]; /*!= dBottom*/
+ double dTop; /*!0 and <=1
+ double dCumulativeCount; /*! */
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Output
+ \brief Structure for defining output parameters used to interpolate a raster. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Output
+{
+ wchar_t sFile[1024]; /*!< Path to the output file. */
+ wchar_t sDriverId[64]; /*!< DriverId used to create the output raster.*/
+ bool bAutoDataType; /*!< If true the system will choose the best output data type, otherwise define them per band in pDataTypes. */
+ int32_t nDataTypes; /*!< Count of data types defined in pDataTypes. */
+ MIR_DataType* pDataTypes; /*!< Output grid data types. Valid MIR_DataType types are UnsignedInt8, SignedInt8, UnsignedInt16, SignedInt16, UnsignedInt32, SignedInt32, RealSingle, RealDouble. */
+ wchar_t sCoordinateSystem[512]; /*!< MapInfo coordinate system string for the output file. */
+ bool bAllowMultiBand; /*!< If true and output format can handle multi-banded data then a multi-banded raster will be created. */
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Geometry
+ \brief Structure for defining geometry parameters used to interpolate a raster. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Geometry
+{
+ bool bAutoGridExtents; /*!< If false supply grid origin, columns and rows, otherwise if true the system will define.*/
+ bool bAutoGridCellSize; /*!< If false supply cell size, otherwise if true the system will define.*/
+ double dOriginX; /*!< X origin of the output grid.*/
+ double dOriginY; /*!< Y origin of the output grid.*/
+ MIR_ExtentType nExtentType; /*!< Determines if dExtentX and dExtentY are in coordinate values or cell values.*/
+ double dExtentX; /*!< Maximum X coordinate or number of columns of the output grid.*/
+ double dExtentY; /*!< Maximum Y coordinate or number of rows of the output grid.*/
+ double dCellSizeX; /*!< X Cell size of the output grid.*/
+ double dCellSizeY; /*!< Y Cell size of the output grid.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Parameters
+ \brief Structure for defining general parameters used to interpolate a raster. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Parameters
+{
+ SMIR_IMP_Preferences cPreferences; /*!< Structure defining interpolation preference parameters.*/
+ SMIR_IMP_Input cInput; /*!< Structure defining interpolation input parameters.*/
+ SMIR_IMP_Output cOutput; /*!< Structure defining interpolation output parameters.*/
+ SMIR_IMP_Geometry cGeometry; /*!< Structure defining interpolation geometry parameters.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Triangulation
+ \brief Structure for defining parameters used to interpolate a raster using the triangulation method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Triangulation
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ uint8_t nPatchMultiplier; /*!< Side length of the triangulation patch, expressed as a number of raster tiles (ranges from 1 to 5).*/
+ double dLongTriangle; /*!< Maximum side length of a triangle, specified in nParameterUnitsType.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_IDW_Sector
+\brief Structure for defining sector parameters used to interpolate a raster using the inverse distance weighted method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_IDW_Sector
+{
+ bool bApply; /*!< Apply sector support.*/
+ int32_t nCount; /*!< Count of sectors to use, valid values are 1 to 32.*/
+ double dOrientation; /*!< Starting orientation of sectors in degrees, valid values are 0 to 360.*/
+ int32_t nMinimumPoints; /*!< Minimum number of points per sector to validate sector, valid values are 1 and greater.*/
+ int32_t nMaximumPoints; /*!< Maximum number of points to use per sector when bNearestPoints is true, if bNearestPoints is false this parameter is not used. Valid values are 1 and greater.*/
+ bool bNearestPoints; /*!< Use nearest nMaximumPoints number of points.*/
+ int32_t nMinimumCount; /*!< Minimum number of valid sectors required, valid values are 1 and greater.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_IDW
+ \brief Structure for defining parameters used to interpolate a raster using the inverse distance weighted method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_IDW
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+
+ double dRadiusX; /*!< X Radius of influence, specified in nParameterUnitsType.*/
+ double dRadiusY; /*!< Y Radius of influence, specified in nParameterUnitsType.*/
+ bool bElliptical; /*!< Radius of influence elliptical.*/
+ double dOrientation; /*!< Ellipse orientation.*/
+ uint32_t nIncrement; /*!< Search increment factor, valid values are 1 or greater.*/
+
+ // Weighting parameters
+ MIR_WeightingModel nModel; /*!< Weighting model.*/
+ double dPower; /*!< Distance weighting.*/
+ double dNugget; /*!< Minimum distance, specified in nParameterUnitsType.*/
+ double dRange; /*!< Maximum distance, specified in nParameterUnitsType.*/
+ double dScale; /*!< Scaling distance, specified in nParameterUnitsType.*/
+
+ // Tapering of input data
+ bool bTaper; /*!< If true a distance tapering function is applied to the interpolated values.*/
+ double dTaperFrom; /*!< Minimum taper distance, specified in nParameterUnitsType.*/
+ double dTaperTo; /*!< Maximum taper distance, specified in nParameterUnitsType.*/
+ double dTaperBackground; /*!< Defined background value.*/
+
+ SMIR_IMP_IDW_Sector cSectors; /*!< Structure defining IDW sector parameters.*/
+
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Distance
+ \brief Structure for defining parameters used to interpolate a raster using the data distance method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Distance
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ double dRadiusX; /*!< X Radius of influence, specified in nParameterUnitsType.*/
+ double dRadiusY; /*!< Y Radius of influence, specified in nParameterUnitsType.*/
+ bool bElliptical; /*!< Radius of influence elliptical.*/
+ double dOrientation; /*!< Ellipse orientation.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*****************************************************************************************************************************/
+
+/*! \struct SMIR_IMP_Density
+ \brief Structure for defining parameters used to interpolate a raster using the data density method.
+ This is used by the Raster Interpolation API.
+
+ Kernel Model
+
+ Point Count Density Estimation Model = 0
+
+ Accumulates the number of points within the bandwidth. Optionally, bias
+ this count by the input data value. Optionally return either the count
+ or the true spatial density by dividing by the elliptical area (PI.A.B).
+
+ Kernel Density Estimation Model = 1 - 7
+
+ This method is well known as a robust statistical technique to compute the
+ point density of any collection of points at a point in space. Optionally
+ return either the estimated value or the normalized density by dividing by
+ the elliptical area (PI.A.B).
+
+ D = (1/(n*h)) * sum (K * U); or is it (1/n) * sum (K(U))?
+ n = number of input samples
+ h = bandwidth (a distance)
+ K = kernel function
+ U = (Xi - X)/h
+
+ So we need to find the distance of every point to the density location.
+ Generally, we only consider points that are within h distance.
+ h can be defined as (hx,hy,hz) for anisotropic density computations.
+
+ K is defined in the following way.
+
+ 1 Uniform 1/2
+ 2 Triangle 1-|U|
+ 3 Epanechnikov 3/4 * (1-U^2)
+ 4 Quartic 15/16 * (1-U^2)^2
+ 5 Triweight 35/32 * (1-U^2)^3
+ 6 Gaussian (1/sqrt(2PI)) * exp(-1/2 * U^2)
+ 7 Cosinus PI/4 * cos(U*PI/2)
+
+ Generally, the kernel is only evaluated for |U| <= 1.
+ For gaussian, h ought to be infinity as it is perfectly smooth.
+ Note that U and |U| are interchangeable in all cases except Triangle.
+*/
+struct SMIR_IMP_Density
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ double dRadiusX; /*!< X Radius of influence, specified in nParameterUnitsType.*/
+ double dRadiusY; /*!< Y Radius of influence, specified in nParameterUnitsType.*/
+ bool bElliptical; /*!< Radius of influence elliptical.*/
+ double dOrientation; /*!< Ellipse orientation.*/
+ MIR_DensityKernel nKernel; /*!< Kernel model used to interpolate value.*/
+ bool bBiasByInput; /*!< If true interpret point value as a count.*/
+ bool bNormalise; /*!< Normalize data frequency values into data density values.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+ double dGaussianSharpening; /*!< Sharpening to Gaussian kernel.*/
+};
+
+/*! \struct SMIR_IMP_Stamp
+ \brief Structure for defining parameters used to interpolate a raster using the stamp method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Stamp
+{
+ MIR_Stamp_StampMethod nStampMethod; /*!< Stamping method to use. */
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*! \struct SMIR_IMP_MinimumCurvature
+ \brief Structure for defining parameters used to interpolate a raster using the minimum curvature method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_MinimumCurvature
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ MIR_IterationIntensity nIterations; /*!< Iteration intensity.*/
+ double dPercentChange; /*!< Degree of bending constraint.*/
+ double dTension; /*!< Spline tension.*/
+ MIR_MinimumCurvature_StampMethod nStampMethod; /*!< Stamping method to use.*/
+ double dIDWRadius; /*!< Search radius around a grid cell, specified in nParameterUnitsType.*/
+ double dIDWRange; /*!< Search range around a grid cell, specified in nParameterUnitsType.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*! \struct SMIR_IMP_NearestNeighbour
+\brief Structure for defining parameters used to interpolate a raster using the nearest neaighbour method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_NearestNeighbour
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ double dMaxSearchDistance; /*!< Maximum search distance (must be greater than 0), specified in nParameterUnitsType.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+/*! \struct SMIR_IMP_NaturalNeighbourIntegration
+\brief Structure for defining parameters used to interpolate a raster using the natural neighbour integration method. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_NaturalNeighbourIntegration
+{
+ MIR_ParameterUnitsType nParameterUnitsType; /*!< Type of units that the specified parameters are stored in.*/
+ MIR_UnitCode nParameterUnitCode; /*!< Units that all parameters are specified in when nParameterUnitsType is set to Distance.*/
+ double dMaxSearchDistance; /*!< Maximum search distance (must be greater than 0), specified in nParameterUnitsType.*/
+ bool bGaussianDistanceWeighted; /*!< Use Gaussian weighting by distance.*/
+ bool bAutoGaussianRange; /*!< If true automatically determines the Gaussian range, if false uses dGaussianRange.*/
+ double dGaussianRange; /*!< Manually defined Gaussian range (must be greater than 0), used when bAutoGaussianRange is false, specified in nParameterUnitsType.*/
+ SMIR_IMP_Clip cClip; /*!< Structure defining clipping parameters.*/
+ SMIR_IMP_Smoothing cSmoothing; /*!< Smoothing parameters to be applied post processing.*/
+};
+
+
+/*! \struct SMIR_IMP_LiDAR_TREECANOPY
+\brief Common LAS filtering parameters for tree canopy analysis operations.
+*/
+struct SMIR_IMP_LiDAR_TREECANOPY
+{
+ bool bExtendedClassification; /*!< Use extended Classification data (LAS 1.4 onwards) instead of standard Classification data.*/
+ bool bEmptyIsZero; /*!< Populate raster cells with no assigned value with zero.*/
+ uint32_t nSuppliedClassRule; /*!< Use Ground classes only (0), Vegetation classes only (1) or Ground and Vegetation classes (2).*/
+ uint32_t nGroundClassCount; /*!< Number of ground classification values supplied.*/
+ uint8_t* pvnGroundClass; /*!< Array of ground classification values.*/
+ uint32_t nVegetationClassCount; /*!< Number of vegetation classification values supplied.*/
+ uint8_t* pvnVegetationClass; /*!< Array of vegetation classification values.*/
+ SMIR_IMP_Clip cCellClip; /*!< Raster cell clipping parameters.*/
+};
+
+/*! \struct SMIR_IMP_LiDAR_TREECANOPY_COVERAGE
+\brief LiDAR analysis Tree Canopy Coverage parameters.
+*/
+struct SMIR_IMP_LiDAR_TREECANOPY_COVERAGE
+{
+ SMIR_IMP_LiDAR_TREECANOPY cCommonLASFilter; /*!< Common LAS filtering parameters.*/
+ bool bIntegrateOverCell; /*!< Integrate over cell (true) or over a supplied radius (false).*/
+ double dSearchRadius; /*!< Integration radius.*/
+ bool bQuarticKernel; /*!< Use a Quartic weighting model for data within the integration radius.*/
+};
+
+/*! \struct SMIR_IMP_LiDAR_TREECANOPY_DENSITY
+\brief LiDAR analysis Tree Canopy Density parameters.
+*/
+struct SMIR_IMP_LiDAR_TREECANOPY_DENSITY
+{
+ SMIR_IMP_LiDAR_TREECANOPY cCommonLASFilter; /*!< Common LAS filtering parameters.*/
+ bool bIntegrateOverCell; /*!< Integrate over cell (true) or over a supplied radius (false).*/
+ double dSearchRadius; /*!< Integration radius.*/
+ bool bQuarticKernel; /*!< Use a Quartic weighting model for data within the integration radius.*/
+};
+
+/*! \struct SMIR_IMP_LiDAR_TREECANOPY_HEIGHT
+\brief LiDAR analysis Tree Canopy Height parameters.
+*/
+struct SMIR_IMP_LiDAR_TREECANOPY_HEIGHT
+{
+ SMIR_IMP_LiDAR_TREECANOPY cCommonLASFilter; /*!< Common LAS filtering parameters.*/
+ uint8_t nPatchMultiplier; /*!< Side length of the triangulation patch, expressed as a number of raster tiles (ranges from 1 to 5).*/
+};
+
+/*! \struct SMIR_IMP_Defaults
+ \brief Structure for defining recommended default parameters that interpolation system can auto compute. This is used by the Raster Interpolation API.
+*/
+struct SMIR_IMP_Defaults
+{
+ double dCellSize; /*!< Cell size to use for output raster.*/
+
+ // only computed if bComputeBounds for method is set to true.
+ double dMinimumX; /*!< Minimum X coordinate.*/
+ double dMinimumY; /*!< Minimum Y coordinate.*/
+ double dMaximumX; /*!< Maximum X coordinate.*/
+ double dMaximumY; /*!< Maximum Y coordinate.*/
+ uint32_t nRows; /*!< Number of rows at dCellSize for the computed bounds.*/
+ uint32_t nColumns; /*!< Number of columns at dCellSize for the computed bounds.*/
+};
+
+/*! \struct SMIR_IMP_Column
+ \brief Column data.
+*/
+struct SMIR_IMP_Column
+{
+ wchar_t sName[1024]; /*!< Column name.*/
+ MIR_DataType nDataType; /*!< Column data type if can be determined.*/
+};
+
+/*! \struct SMIR_IMP_ColumnInfo
+ \brief Structure for defining the number and names of the columns in a file that can be interpolated using the raster interpolation engine.
+*/
+struct SMIR_IMP_ColumnInfo
+{
+ uint32_t nColumnCount; /*!< Number of columns defined in vColumn.*/
+ SMIR_IMP_Column vColumns[1024]; /*!< List of column names.*/
+};
+
+/*! \struct SMIR_IMP_FileName
+ \brief File name.
+*/
+struct SMIR_IMP_FileName
+{
+ wchar_t sFileName[1024]; /*!< File name.*/
+};
+
+/*! \struct SMIR_IMP_Filenames
+ \brief Structure for defining the number and names of the output files that will be created when interpolated using the raster interpolation engine.
+*/
+struct SMIR_IMP_Filenames
+{
+ uint32_t nFileCount; /*!< Number of files defined in vFileName.*/
+ SMIR_IMP_FileName vFileName[1024]; /*!< List of file names.*/
+};
+
+/*! \struct SMIR_IMP_Group
+\brief Group info.
+*/
+struct SMIR_IMP_Group
+{
+ wchar_t sItem[1024]; /*!< Group name.*/
+ uint32_t nCount; /*!< Count of items in this group.*/
+};
+
+/*! \struct SMIR_IMP_Groups
+\brief Structure for defining the number and names of the groups that are defined the given grouping field in the file.
+*/
+struct SMIR_IMP_Groups
+{
+ uint32_t nCount; /*!< Number of groups defined in pvGroups.*/
+ SMIR_IMP_Group* pvGroups; /*!< List of group names.*/
+};
+
+/*! \struct MIR_RegistrationPoint
+ \brief Structure top control a registration point
+*/
+typedef struct
+{
+ double dWorldX, dWorldY;
+ double nPixelX, nPixelY;
+} MIR_RegistrationPoint;
+
+
+/*! \enum MIR_WarpTransformType
+ \brief Types of image warp transforms.
+*/
+enum MIR_WarpTransformType
+{
+ Auto = -1,
+ Conformal = 0,
+ Affine,
+ Projective,
+ Polynomial_O2,
+ Conformal_Polynomial_O2,
+ Polynomial_O3,
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gdal/frmts/mrr/GNUmakefile b/gdal/frmts/mrr/GNUmakefile
new file mode 100644
index 000000000000..524ba177411d
--- /dev/null
+++ b/gdal/frmts/mrr/GNUmakefile
@@ -0,0 +1,29 @@
+include ../../GDALmake.opt
+
+OBJ = MRRDataset.o MRRRasterBand.o MRRSDKImpl.o
+
+LDFLAGS += -ldl -shared
+
+CPPFLAGS := -DFRMT_mrr -std=c++11 $(CPPFLAGS)
+
+PLUGIN_SO = gdal_MRR.so
+
+default: $(OBJ:.o=.$(OBJ_EXT))
+
+clean:
+ rm -f *.o $(O_OBJ)
+ rm -f *.lo $(O_OBJ)
+
+install-obj: $(O_OBJ:.o=.$(OBJ_EXT))
+
+plugin: $(PLUGIN_SO)
+
+#$(PLUGIN_SO): $(OBJ:.o=.lo)
+# $(LD) $(LDFLAGS) ../../$(LIBGDAL) -o $@ $(OBJ:.o=.lo) \
+# -rpath $(INST_LIB) \
+# -no-undefined -export-dynamic
+
+$(PLUGIN_SO): $(OBJ)
+ $(LD_SHARED) $(LNK_FLAGS) $(OBJ) $(CONFIG_LIBS) $(EXTRA_LIBS) \
+ -o $(PLUGIN_SO)
+
diff --git a/gdal/frmts/mrr/MRRDataset.cpp b/gdal/frmts/mrr/MRRDataset.cpp
new file mode 100644
index 000000000000..9d70c70dfe89
--- /dev/null
+++ b/gdal/frmts/mrr/MRRDataset.cpp
@@ -0,0 +1,570 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#include "MRRDataset.h"
+#include "MRRRasterBand.h"
+#include "MRRSDKImpl.h"
+#include "ogr_spatialref.h"
+
+CPL_C_START
+void CPL_DLL GDALRegister_MRR(void);
+CPL_C_END
+
+//////////////////////////////////////////////////////////////////////////
+// Method declarations
+GDALDataType AdjustBandDataType(MIR_DataType& mirDataType);
+bool MRRInitialize(bool logError = true);
+void GDALDeregister_MRR(GDALDriver *);
+//////////////////////////////////////////////////////////////////////////
+
+/*
+ It returns the appropriate GDAL data type for the MIR data types.
+ If data type is not supported in the GDAL this mehtod promotes (modify) the MIRDataType.
+*/
+GDALDataType AdjustBandDataType(MIR_DataType& mirDataType)
+{
+ GDALDataType gdalDataType;
+
+ switch (mirDataType)
+ {
+ case MIR_DataType::MIR_BIT1: //GDAL doesn't have these data types, so promote to 8 bit
+ case MIR_DataType::MIR_BIT2:
+ case MIR_DataType::MIR_BIT4:
+ case MIR_DataType::MIR_RED:
+ case MIR_DataType::MIR_GREEN:
+ case MIR_DataType::MIR_BLUE:
+ case MIR_DataType::MIR_ALPHA:
+ case MIR_DataType::MIR_GREY:
+ case MIR_DataType::MIR_UNSIGNED_INT8:
+ gdalDataType = GDALDataType::GDT_Byte;
+ break;
+
+ case MIR_DataType::MIR_RED_ALPHA:
+ case MIR_DataType::MIR_BLUE_ALPHA:
+ case MIR_DataType::MIR_GREEN_ALPHA:
+ case MIR_DataType::MIR_GREY_ALPHA:
+ case MIR_DataType::MIR_UNSIGNED_INT16:
+ gdalDataType = GDALDataType::GDT_UInt16;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT16:
+ gdalDataType = GDALDataType::GDT_Int16;
+ break;
+
+ case MIR_DataType::MIR_UNSIGNED_INT32:
+ gdalDataType = GDALDataType::GDT_UInt32;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT32:
+ gdalDataType = GDALDataType::GDT_Int32;
+ break;
+
+ case MIR_DataType::MIR_REAL4:
+ gdalDataType = GDALDataType::GDT_Float32;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT64:
+ case MIR_DataType::MIR_UNSIGNED_INT64:
+ case MIR_DataType::MIR_REAL8:
+ case MIR_DataType::MIR_REAL_LONG:
+ mirDataType = MIR_DataType::MIR_REAL8;
+ gdalDataType = GDALDataType::GDT_Float64;
+ break;
+
+ case MIR_DataType::MIR_BGR:
+ case MIR_DataType::MIR_BGRA:
+ case MIR_DataType::MIR_RGB:
+ case MIR_DataType::MIR_RGBA:
+ gdalDataType = GDALDataType::GDT_UInt32;
+ break;
+
+ //GDAL doesn't have this data type, so promote to 16 bit
+ case MIR_DataType::MIR_SIGNED_INT8:
+ gdalDataType = GDALDataType::GDT_Int16;
+ mirDataType = MIR_DataType::MIR_SIGNED_INT16;
+ break;
+
+ //8 bytes should be sufficient for all types
+ default:
+ mirDataType = MIR_DataType::MIR_REAL8;
+ gdalDataType = GDALDataType::GDT_Float64;
+ }
+
+ return gdalDataType;
+}
+
+bool MRRInitialize(bool logError)
+{
+ if (SDKDynamicImpl::Get().Init() == false)
+ {
+ if (logError)
+ {
+ CPLError(CE_Failure, CPLE_AppDefined, "Unable to load MapInfo MRR SDK \n");
+ }
+ return false;
+ }
+
+ return true;
+}
+
+MRRDataset::MRRDataset(const uint32_t& dsHandle, const uint32_t& infoHandle) : nDatasetHandle(dsHandle), nInfoHandle(infoHandle)
+{
+ pszProjection = CPLStrdup("");
+ dCellSizeX = dCellSizeY = dOriginX = dOriginY = 0.0;
+ nCellAtGridOriginX = nCellAtGridOriginY = 0;
+ pColorTable = nullptr;
+ bCategoriesInitialized = false;
+ pszCategories = nullptr;
+}
+
+MRRDataset::~MRRDataset()
+{
+ SDKDynamicImpl::Get().ReleaseRasterInfo()(nInfoHandle);
+ SMIR_FinalisationOptions cFinalize;
+ SDKDynamicImpl::Get().CloseRaster()(nDatasetHandle, nullptr, InvalidTracker);
+
+ CSLDestroy(pszCategories);
+
+ CPLFree(pszProjection);
+
+ if (pColorTable)
+ delete pColorTable;
+ pColorTable = nullptr;
+}
+
+/*
+ Populate color entries.
+*/
+void MRRDataset::PopulateColorTable(const uint32_t& nFieldIndex)
+{
+ pColorTable = new GDALColorTable();
+
+ uint32_t nRecordCount = 0;
+ auto nDSHandle = GetDSHandle();
+ if (SDKDynamicImpl::Get().ClassTableGetRecordCount()(nDSHandle, nFieldIndex, nRecordCount) == MIRSuccess)
+ {
+ uint32_t nClassTableRGBField = 0;
+ if (SDKDynamicImpl::Get().ClassTableFindField()(nDSHandle, nFieldIndex, MIR_ClassTableFieldType::MIR_TFT_Colour, nClassTableRGBField) == MIRSuccess)
+ {
+ for (uint32_t nRec = 0; nRec < nRecordCount; nRec++)
+ {
+ GDALColorEntry colorEntry;
+ MIR_DataType nDataType;
+ uint32_t nDataSize;
+ uint32_t *pData = nullptr;
+
+ if (SDKDynamicImpl::Get().ClassTableGetRecord()(nDSHandle, nFieldIndex, nClassTableRGBField, nRec, (uint8_t**)&pData, nDataType, nDataSize) == MIRSuccess)
+ {
+ colorEntry.c1 = (uint8_t)((*pData & 0x000000ff)); //red
+ colorEntry.c2 = (uint8_t)((*pData & 0x0000ff00) >> 8); //green
+ colorEntry.c3 = (uint8_t)((*pData & 0x00ff0000) >> 16); //blue
+ colorEntry.c4 = (short)255; //alpha
+
+ SDKDynamicImpl::Get().ReleaseData()((uint8_t**)&pData);
+ }
+
+ pColorTable->SetColorEntry(nRec, &colorEntry);
+ }
+ }
+ else
+ {
+ MIR_ClassTableFieldType nTFTColours[] = { MIR_ClassTableFieldType::MIR_TFT_ColourR, MIR_ClassTableFieldType::MIR_TFT_ColourG, MIR_ClassTableFieldType::MIR_TFT_ColourB };
+ uint32_t nClassTableFields[3] = { 0 };
+
+ for (int nB = 0; nB < 3; nB++)
+ SDKDynamicImpl::Get().ClassTableFindField()(nDSHandle, nFieldIndex, nTFTColours[nB], nClassTableFields[nB]);
+
+ for (uint32_t nRec = 0; nRec < nRecordCount; nRec++)
+ {
+ GDALColorEntry colorEntry;
+ uint32_t *pData = nullptr;
+ MIR_DataType nDataType;
+ uint32_t nDataSize;
+
+ if (SDKDynamicImpl::Get().ClassTableGetRecord()(nDSHandle, nFieldIndex, nClassTableFields[0], nRec, (uint8_t**)&pData, nDataType, nDataSize) == MIRSuccess)
+ {
+ colorEntry.c1 = (uint8_t)((*pData)); //red
+ SDKDynamicImpl::Get().ReleaseData()((uint8_t**)&pData);
+ }
+ if (SDKDynamicImpl::Get().ClassTableGetRecord()(nDSHandle, nFieldIndex, nClassTableFields[1], nRec, (uint8_t**)&pData, nDataType, nDataSize) == MIRSuccess)
+ {
+ colorEntry.c2 = (uint8_t)((*pData)); //green
+ SDKDynamicImpl::Get().ReleaseData()((uint8_t**)&pData);
+ }
+ if (SDKDynamicImpl::Get().ClassTableGetRecord()(nDSHandle, nFieldIndex, nClassTableFields[2], nRec, (uint8_t**)&pData, nDataType, nDataSize) == MIRSuccess)
+ {
+ colorEntry.c3 = (uint8_t)((*pData)); //blue
+ SDKDynamicImpl::Get().ReleaseData()((uint8_t**)&pData);
+ }
+
+ colorEntry.c4 = (short)255; //alpha
+ pColorTable->SetColorEntry(nRec, &colorEntry);
+ }
+ }
+ }
+}
+
+/*
+ Populate categories.
+*/
+void MRRDataset::PopulateCategories(const uint32_t& nFieldIndex)
+{
+ if (bCategoriesInitialized)
+ return;
+
+ uint32_t nRecordCount = 0;
+ auto nDSHandle = GetDSHandle();
+ if (SDKDynamicImpl::Get().ClassTableGetRecordCount()(nDSHandle, nFieldIndex, nRecordCount) == MIRSuccess)
+ {
+ {
+ uint32_t nClassTableLabelField = 0;
+ if (SDKDynamicImpl::Get().ClassTableFindField()(nDSHandle, nFieldIndex, MIR_ClassTableFieldType::MIR_TFT_Label, nClassTableLabelField) == MIRSuccess)
+ {
+ pszCategories = (char**)CPLCalloc(nRecordCount + 2, sizeof(char*));
+
+ for (uint32_t nRec = 0; nRec < nRecordCount; nRec++)
+ {
+ MIR_DataType nDataType;
+ uint32_t nDataSize;
+ uint8_t *pData = nullptr;
+
+ if (SDKDynamicImpl::Get().ClassTableGetRecord()(nDSHandle, nFieldIndex, nClassTableLabelField, nRec, (uint8_t**)&pData, nDataType, nDataSize) == MIRSuccess)
+ {
+ char* pStr = (char*)CPLMalloc(nDataSize + 1);
+ strncpy(pStr, (char*)pData, nDataSize);
+ pStr[nDataSize] = '\0';
+ pszCategories[nRec] = pStr;
+
+ SDKDynamicImpl::Get().ReleaseData()((uint8_t**)&pData);
+ }
+ else
+ {
+ pszCategories[nRec] = CPLStrdup("");
+ }
+ }
+
+ //Let's not leave any entry to null, mark them as ""
+ for (uint32_t nID = 0; nID < nRecordCount; nID++)
+ {
+ if (pszCategories[nID] == nullptr)
+ pszCategories[nID] = CPLStrdup("");
+ }
+
+ pszCategories[nRecordCount + 1] = nullptr;
+ }
+ }
+ }
+
+ bCategoriesInitialized = true;
+}
+
+char** MRRDataset::GetCategoryNames(const CPL_UNUSED uint32_t& nField)
+{
+ return pszCategories;
+}
+
+
+GDALDataset *MRRDataset::OpenMRR(GDALOpenInfo * poOpenInfo)
+{
+ if (MRRInitialize() == false)
+ return nullptr;
+
+ // -------------------------------------------------------------------- //
+ // Confirm that the file is a valid MRR dataset. //
+ // -------------------------------------------------------------------- //
+
+ if (!IdentifyMRR(poOpenInfo))
+ return nullptr;
+
+ // -------------------------------------------------------------------- //
+ // Confirm the requested access is supported. //
+ // -------------------------------------------------------------------- //
+ if (poOpenInfo->eAccess == GA_Update)
+ {
+ CPLError(CE_Failure, CPLE_NotSupported, "MapInfo MRR driver does not support update access to existing files"
+ " datasets.\n");
+ return nullptr;
+ }
+
+ // -------------------------------------------------------------------- //
+ // Create a corresponding GDALDataset. //
+ // -------------------------------------------------------------------- //
+
+ uint32_t nDSHandle = MIRInvalidHandle, nInfoHandle = MIRInvalidHandle;
+ {
+ wchar_t *pwszFilename = CPLRecodeToWChar(poOpenInfo->pszFilename, CPL_ENC_UTF8, CPL_ENC_UCS2);
+ if (SDKDynamicImpl::Get().OpenRaster_ReadOnly()(pwszFilename, nDSHandle, MIR_RasterSupportMode::MIR_Support_Full, MIR_FieldType::MIR_FIELD_Default, InvalidTracker) != MIRSuccess)
+ {
+ CPLError(CE_Failure, CPLE_OpenFailed, "MapInfo MRR driver is unable to open the file.\n");
+ CPLFree(pwszFilename);
+ return nullptr;
+ }
+ CPLFree(pwszFilename);
+ }
+
+ MRRDataset* poDS = nullptr;
+ const uint32_t nFieldIndex = 0;
+ if (SDKDynamicImpl::Get().GetOpenInfo()(nDSHandle, nInfoHandle, InvalidTracker) == MIRSuccess)
+ {
+ SMIR_RasterInfo *pRasterInfo = nullptr;
+ SMIR_FieldInfo* pFieldInfo = nullptr;
+ uint32_t nXBlockSize, nYBlockSize;
+
+ SDKDynamicImpl::Get().RasterInfo()(nInfoHandle, &pRasterInfo);
+
+ SDKDynamicImpl::Get().FieldInfo()(nInfoHandle, 0, &pFieldInfo);
+ uint32_t nBandCount = SDKDynamicImpl::Get().InfoBandCount()(nInfoHandle, nFieldIndex);
+
+ poDS = new MRRDataset(nDSHandle, nInfoHandle);
+ poDS->nRasterXSize = (int)pRasterInfo->nGridSizeX;
+ poDS->nRasterYSize = (int)pRasterInfo->nGridSizeY;
+ nXBlockSize = (uint32_t)pRasterInfo->nBaseTileSizeX;
+ nYBlockSize = (uint32_t)pRasterInfo->nBaseTileSizeY;
+ poDS->nXBlocksCount = (uint32_t)ceil((double)(pRasterInfo->nGridSizeX * 1.0 / nXBlockSize));
+ poDS->nYBlocksCount = (uint32_t)ceil((double)(pRasterInfo->nGridSizeY * 1.0 / nYBlockSize));
+
+ poDS->dCellSizeX = pFieldInfo->cCellSizeX.m_dDecimal;
+ poDS->dCellSizeY = pFieldInfo->cCellSizeY.m_dDecimal;
+ poDS->dOriginX = pFieldInfo->cTileOriginX.m_dDecimal;
+ poDS->dOriginY = pFieldInfo->cTileOriginY.m_dDecimal;
+
+ poDS->nCellAtGridOriginX = pFieldInfo->nCellAtGridOriginX;
+ poDS->nCellAtGridOriginY = pFieldInfo->nCellAtGridOriginY;
+
+ //Convert projection to WKT
+ OGRSpatialReference oSRS;
+ auto pCoordSys = CPLRecodeFromWChar(pRasterInfo->sCoordinateSystem, CPL_ENC_UCS2, CPL_ENC_UTF8);
+ if (pCoordSys && oSRS.importFromMICoordSys(pCoordSys) == OGRERR_NONE)
+ {
+ CPLFree(poDS->pszProjection);
+ oSRS.exportToWkt(&poDS->pszProjection);
+ }
+ poDS->SetProjection(poDS->pszProjection);
+ CPLFree(pCoordSys);
+
+ // -------------------------------------------------------------------- //
+ // Mount Bands, Create band information objects. //
+ // -------------------------------------------------------------------- //
+
+ switch (pFieldInfo->nType)
+ {
+ //Mount all bands
+ case MIR_FieldType::MIR_FIELD_Continuous:
+ {
+ uint32_t nGDALBandIndex = 1;
+ for (uint32_t nBand = 0; nBand < nBandCount; nBand++)
+ {
+ SMIR_BandInfo* pBandInfo = nullptr;
+ if (SDKDynamicImpl::Get().BandInfo()(nInfoHandle, nFieldIndex, nBand, &pBandInfo) == MIRSuccess)
+ {
+ auto nMIRDataType = pBandInfo->nDataType;
+ auto nGDALDataType = AdjustBandDataType(nMIRDataType);
+ poDS->SetBand(nGDALBandIndex, new MRRRasterBand(poDS, pFieldInfo->nType, nFieldIndex, nBand, 0, nMIRDataType,
+ nGDALDataType, (int)pRasterInfo->nGridSizeX, (int)pRasterInfo->nGridSizeY, nXBlockSize, nYBlockSize));
+ nGDALBandIndex++;
+ }
+ }
+ }
+ break;
+
+ //If band count is >= 4 , mount 3 bands starting from 1st index.
+ //If there is only one band, mount 0th band.
+ case MIR_FieldType::MIR_FIELD_Image:
+ {
+ if (nBandCount >= 4)
+ {
+ uint32_t nGDALBandIndex = 1;
+ uint32_t nMRRBandIndex = 1;
+ for (uint32_t nB = 1; nB <= nBandCount; nB++)
+ {
+ SMIR_BandInfo* pBandInfo = nullptr;
+ if (SDKDynamicImpl::Get().BandInfo()(nInfoHandle, nFieldIndex, nB, &pBandInfo) == MIRSuccess)
+ {
+ auto nMIRDataType = pBandInfo->nDataType;
+ auto nGDALDataType = AdjustBandDataType(nMIRDataType);
+ poDS->SetBand(nGDALBandIndex, new MRRRasterBand(poDS, pFieldInfo->nType, nFieldIndex, nMRRBandIndex, 0, nMIRDataType,
+ nGDALDataType, (int)pRasterInfo->nGridSizeX, (int)pRasterInfo->nGridSizeY, nXBlockSize, nYBlockSize));
+ nGDALBandIndex++;
+ nMRRBandIndex++;
+ }
+ }
+ }
+ else if (nBandCount == 1)
+ {
+ uint32_t nMRRBandIndex = 0;
+ SMIR_BandInfo* pBandInfo = nullptr;
+ if (SDKDynamicImpl::Get().BandInfo()(nInfoHandle, nFieldIndex, nMRRBandIndex, &pBandInfo) == MIRSuccess)
+ {
+ auto nMIRDataType = pBandInfo->nDataType;
+ auto nGDALDataType = AdjustBandDataType(nMIRDataType);
+ uint32_t nGDALBandIndex = 1;
+
+ poDS->SetBand(nGDALBandIndex, new MRRRasterBand(poDS, pFieldInfo->nType, nFieldIndex, nMRRBandIndex, 0, nMIRDataType,
+ nGDALDataType, (int)pRasterInfo->nGridSizeX, (int)pRasterInfo->nGridSizeY, nXBlockSize, nYBlockSize));
+ nGDALBandIndex++;
+ }
+ }
+ }
+ break;
+
+ //Mount 0th band, populate Colour table too.
+ case MIR_FieldType::MIR_FIELD_ImagePalette:
+ {
+ uint32_t nMRRBandIndex = 0;
+ SMIR_BandInfo* pBandInfo = nullptr;
+ if (SDKDynamicImpl::Get().BandInfo()(nInfoHandle, nFieldIndex, nMRRBandIndex, &pBandInfo) == MIRSuccess)
+ {
+ auto nMIRDataType = pBandInfo->nDataType;
+ auto nGDALDataType = AdjustBandDataType(nMIRDataType);
+ uint32_t nGDALBandIndex = 1;
+
+ poDS->SetBand(nGDALBandIndex, new MRRRasterBand(poDS, pFieldInfo->nType, nFieldIndex, nMRRBandIndex, 0, nMIRDataType,
+ nGDALDataType, (int)pRasterInfo->nGridSizeX, (int)pRasterInfo->nGridSizeY, nXBlockSize, nYBlockSize));
+ nGDALBandIndex++;
+ }
+
+ ///////////////////////////////////////////////////////
+ //Initialize color table here.
+ ///////////////////////////////////////////////////////
+ {
+ poDS->PopulateColorTable(nFieldIndex);
+ }
+ }
+ break;
+
+ //Mount 0th band, populate Colour table and Categories.
+ case MIR_FieldType::MIR_FIELD_Classified:
+ {
+ uint32_t nGDALBandIndex = 1;
+ uint32_t nMRRBandIndex = 0;
+ SMIR_BandInfo* pBandInfo = nullptr;
+ if (SDKDynamicImpl::Get().BandInfo()(nInfoHandle, nFieldIndex, nMRRBandIndex, &pBandInfo) == MIRSuccess)
+ {
+ auto nMIRDataType = pBandInfo->nDataType;
+ auto nGDALDataType = AdjustBandDataType(nMIRDataType);
+ poDS->SetBand(nGDALBandIndex, new MRRRasterBand(poDS, pFieldInfo->nType, nFieldIndex, nMRRBandIndex, 0, nMIRDataType,
+ nGDALDataType, (int)pRasterInfo->nGridSizeX, (int)pRasterInfo->nGridSizeY, nXBlockSize, nYBlockSize));
+ nGDALBandIndex++;
+ }
+
+ ///////////////////////////////////////////////////////
+ //Initialize color table here.
+ ///////////////////////////////////////////////////////
+ {
+ poDS->PopulateColorTable(nFieldIndex);
+ }
+
+ ///////////////////////////////////////////////////////
+ //Initialize class table (categories) here.
+ ///////////////////////////////////////////////////////
+ {
+ poDS->PopulateCategories(nFieldIndex);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // -------------------------------------------------------------------- //
+ // Initialize any PAM information. //
+ // -------------------------------------------------------------------- //
+ poDS->SetDescription(poOpenInfo->pszFilename);
+
+ // -------------------------------------------------------------------- //
+ // Initialize default overviews. //
+ // -------------------------------------------------------------------- //
+ poDS->oOvManager.Initialize(poDS, poOpenInfo->pszFilename);
+ }
+
+ return(poDS);
+}
+
+
+
+// IdentifyMRR()
+//Return 1 if the passed file is certainly recognized by the driver
+//Return 0 if the passed file is certainly NOT recognized by the driver
+//Return - 1 if the passed file may be or may not be recognized by the driver and that a potentially costly test must be done with pfnOpen.
+
+int MRRDataset::IdentifyMRR(GDALOpenInfo * poOpenInfo)
+{
+ if (MRRInitialize() == false)
+ return 0;
+
+ if (EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "mrr"))
+ {
+ const char* pszFileName = poOpenInfo->pszFilename;
+ {
+ wchar_t *pwszFilename = CPLRecodeToWChar(pszFileName, CPL_ENC_UTF8, CPL_ENC_UCS2);
+ bool bIdentify = (SDKDynamicImpl::Get().VerifyRaster() && SDKDynamicImpl::Get().VerifyRaster()(pwszFilename) == MIRSuccess);
+ CPLFree(pwszFilename);
+ return bIdentify ? 1 : 0;
+ }
+ }
+
+ return 0;
+}
+
+/************************************************************************/
+/* GetGeoTransform() */
+/************************************************************************/
+
+CPLErr MRRDataset::GetGeoTransform(double * padfTransform)
+{
+ padfTransform[0] = dOriginX; /* X Origin (top left corner) */
+ padfTransform[1] = dCellSizeX; /* X Pixel size */
+ padfTransform[2] = 0;
+ padfTransform[3] = dOriginY + (dCellSizeY * nRasterYSize); /* Y Origin (top left corner) */
+ padfTransform[4] = 0;
+ padfTransform[5] = -dCellSizeY; /* Y Pixel Size */
+
+ return CE_None;
+}
+
+const char * MRRDataset::GetProjectionRef()
+{
+ return pszProjection;
+}
+
+void GDALDeregister_MRR(GDALDriver *)
+{
+}
+
+void GDALRegister_MRR()
+{
+ if (!GDAL_CHECK_VERSION("MRR"))
+ return;
+
+ if (MRRInitialize(true) == false)
+ return;
+
+ if (GDALGetDriverByName("MRR") == nullptr)
+ {
+ GDALDriver *poDriver = new GDALDriver();
+
+ poDriver->SetDescription("MRR");
+ poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES");
+ poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "MapInfo Multi Resolution Raster");
+ poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "frmt_mrr.html");
+ poDriver->SetMetadataItem(GDAL_DMD_EXTENSION, "mrr");
+
+ poDriver->pfnOpen = MRRDataset::OpenMRR;
+ poDriver->pfnIdentify = MRRDataset::IdentifyMRR;
+ poDriver->pfnUnloadDriver = GDALDeregister_MRR;
+
+ GetGDALDriverManager()->RegisterDriver(poDriver);
+ }
+}
diff --git a/gdal/frmts/mrr/MRRDataset.h b/gdal/frmts/mrr/MRRDataset.h
new file mode 100644
index 000000000000..a1d55a813d61
--- /dev/null
+++ b/gdal/frmts/mrr/MRRDataset.h
@@ -0,0 +1,56 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#include "gdal_pam.h"
+#include "APIDef.h"
+
+class MRRDataset : public GDALPamDataset
+{
+ friend class MRRRasterBand;
+ uint32_t nDatasetHandle;
+ uint32_t nInfoHandle;
+ uint32_t nXBlocksCount; //block count in X direction
+ uint32_t nYBlocksCount; //block count in Y direction
+ int64_t nCellAtGridOriginX; //Cell Offset in X direction
+ int64_t nCellAtGridOriginY; //Cell Offset in Y direction
+ double dCellSizeX, dCellSizeY, dOriginX, dOriginY;
+ char* pszProjection;
+ bool bCategoriesInitialized;
+ char** pszCategories;
+ GDALColorTable* pColorTable;
+
+
+ MRRDataset() {}
+ const uint32_t& GetDSHandle() const { return nDatasetHandle; }
+ const uint32_t& GetInfoHandle() const { return nInfoHandle; }
+ const unsigned int & GetXBlocks() { return nXBlocksCount; }
+ const unsigned int & GetYBlocks() { return nYBlocksCount; }
+ void PopulateColorTable(const uint32_t& nFieldIndex);
+ void PopulateCategories(const uint32_t& nFieldIndex);
+ GDALColorTable* GetColorTable() const { return pColorTable; }
+ char** GetCategoryNames(const uint32_t& nField);
+
+public:
+ MRRDataset(const uint32_t& nDatasetHandle, const uint32_t& nInfoHandle);
+ ~MRRDataset();
+
+ CPLErr GetGeoTransform(double * padfTransform) override;
+ const char * GetProjectionRef();
+
+ //Static methods
+ static GDALDataset* OpenMRR(GDALOpenInfo *);
+ static int IdentifyMRR(GDALOpenInfo *);
+};
+
+
diff --git a/gdal/frmts/mrr/MRRRasterBand.cpp b/gdal/frmts/mrr/MRRRasterBand.cpp
new file mode 100644
index 000000000000..94f8a7d0615c
--- /dev/null
+++ b/gdal/frmts/mrr/MRRRasterBand.cpp
@@ -0,0 +1,670 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#include "MRRDataset.h"
+#include "MRRRasterBand.h"
+#include "MRRSDKImpl.h"
+#include
+
+/*
+ Fill data array with NoDataValue If cell is not valid.
+*/
+
+//////////////////////////////////////////////////////////////////////////
+// Method declarations
+void FilterDataArray(const int& nXSize, const int& nYSize, uint8_t* pDataArray, uint8_t* pValidArray, const MIR_DataType& nDataType, const double& dNoDataValue);
+MIR_DataType ConvertToMIRDataTypes(const GDALDataType& gdalDataType);
+double DataTypeNoDataVal(const MIR_DataType& mirDataType);
+MIR_InterpolationMethod GetInterpMethod(const GDALRIOResampleAlg& resampleAlgo);
+CPLErr MIRReadBlock(const uint32_t& nItHandle, const uint32_t& nBand, const int64_t& nCellX, const int64_t& nCellY,
+ const int& nBlockXSize, const int& nBlockYSize, const MIR_DataType& nDataType, const uint32_t& nSizeInByte, void* pImage, const double& dNoDataValue);
+//////////////////////////////////////////////////////////////////////////
+
+
+void FilterDataArray(const int& nXSize, const int& nYSize, uint8_t* pDataArray, uint8_t* pValidArray, const MIR_DataType& nDataType, const double& dNoDataValue)
+{
+ for (int nY = 0; nY < nYSize; nY++)
+ {
+ auto nRowPos = nXSize * nY;
+ for (int nX = 0; nX < nXSize; nX++)
+ {
+ auto nCellPos = nRowPos + nX;
+ if (pValidArray[nCellPos] != 1)
+ {
+ switch (nDataType)
+ {
+ case MIR_DataType::MIR_BIT1: //GDAL doesn't have these data types, so promote to 8 bit
+ case MIR_DataType::MIR_BIT2:
+ case MIR_DataType::MIR_BIT4:
+ case MIR_DataType::MIR_RED:
+ case MIR_DataType::MIR_GREEN:
+ case MIR_DataType::MIR_BLUE:
+ case MIR_DataType::MIR_ALPHA:
+ case MIR_DataType::MIR_GREY:
+ case MIR_DataType::MIR_UNSIGNED_INT8:
+ ((uint8_t*)pDataArray)[nCellPos] = (uint8_t)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_RED_ALPHA:
+ case MIR_DataType::MIR_BLUE_ALPHA:
+ case MIR_DataType::MIR_GREEN_ALPHA:
+ case MIR_DataType::MIR_GREY_ALPHA:
+ case MIR_DataType::MIR_UNSIGNED_INT16:
+ ((uint16_t*)pDataArray)[nCellPos] = (uint16_t)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT16:
+ ((int16_t*)pDataArray)[nCellPos] = (int16_t)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_UNSIGNED_INT32:
+ ((uint32_t*)pDataArray)[nCellPos] = (uint32_t)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT32:
+ ((int32_t*)pDataArray)[nCellPos] = (int32_t)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_REAL4:
+ // cppcheck-suppress invalidPointerCast
+ ((float*)pDataArray)[nCellPos] = (float)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_SIGNED_INT64:
+ case MIR_DataType::MIR_UNSIGNED_INT64:
+ case MIR_DataType::MIR_REAL8:
+ case MIR_DataType::MIR_REAL_LONG:
+ // cppcheck-suppress invalidPointerCast
+ ((double*)pDataArray)[nCellPos] = (double)dNoDataValue;
+ break;
+
+ case MIR_DataType::MIR_BGR:
+ case MIR_DataType::MIR_BGRA:
+ case MIR_DataType::MIR_RGB:
+ case MIR_DataType::MIR_RGBA:
+ ((uint32_t*)pDataArray)[nCellPos] = (uint32_t)dNoDataValue;
+ break;
+
+ //GDAL doesn't have this data type, so promote to 16 bit
+ case MIR_DataType::MIR_SIGNED_INT8:
+ ((int16_t*)pDataArray)[nCellPos] = (std::numeric_limits::max)();
+ break;
+
+ //8 bytes should be sufficient for rest of the types.
+ default:
+ // cppcheck-suppress invalidPointerCast
+ ((double*)pDataArray)[nCellPos] = (double)dNoDataValue;
+
+ }
+ }
+ }
+ }
+}
+
+/*
+ Convert GDALDataType to corresponding MIRDataType
+*/
+MIR_DataType ConvertToMIRDataTypes(const GDALDataType& gdalDataType)
+{
+ switch (gdalDataType)
+ {
+ case GDALDataType::GDT_Byte:
+ return MIR_DataType::MIR_UNSIGNED_INT8;
+ case GDALDataType::GDT_Int16:
+ return MIR_DataType::MIR_SIGNED_INT16;
+ case GDALDataType::GDT_UInt16:
+ return MIR_DataType::MIR_UNSIGNED_INT16;
+ case GDALDataType::GDT_Int32:
+ return MIR_DataType::MIR_SIGNED_INT32;
+ case GDALDataType::GDT_UInt32:
+ return MIR_DataType::MIR_UNSIGNED_INT32;
+ case GDALDataType::GDT_Float32:
+ return MIR_DataType::MIR_REAL4;
+ default:
+ case GDALDataType::GDT_Float64:
+ return MIR_DataType::MIR_REAL8;
+ }
+}
+
+/*
+ Returns NoDataValue for the datatype.
+*/
+double DataTypeNoDataVal(const MIR_DataType& mirDataType)
+{
+ switch (mirDataType)
+ {
+ case MIR_DataType::MIR_BIT1: //GDAL doesn't have these data types, so promote to 8 bit
+ case MIR_DataType::MIR_BIT2:
+ case MIR_DataType::MIR_BIT4:
+ case MIR_DataType::MIR_RED:
+ case MIR_DataType::MIR_GREEN:
+ case MIR_DataType::MIR_BLUE:
+ case MIR_DataType::MIR_ALPHA:
+ case MIR_DataType::MIR_GREY:
+ case MIR_DataType::MIR_UNSIGNED_INT8:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_RED_ALPHA:
+ case MIR_DataType::MIR_BLUE_ALPHA:
+ case MIR_DataType::MIR_GREEN_ALPHA:
+ case MIR_DataType::MIR_GREY_ALPHA:
+ case MIR_DataType::MIR_UNSIGNED_INT16:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_SIGNED_INT16:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_UNSIGNED_INT32:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_SIGNED_INT32:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_REAL4:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_SIGNED_INT64:
+ case MIR_DataType::MIR_UNSIGNED_INT64:
+ case MIR_DataType::MIR_REAL8:
+ return (std::numeric_limits::max)();
+
+ case MIR_DataType::MIR_BGR:
+ case MIR_DataType::MIR_BGRA:
+ case MIR_DataType::MIR_RGB:
+ case MIR_DataType::MIR_RGBA:
+ return (std::numeric_limits::max)();
+
+ //GDAL doesn't have this data type, so promote to 16 bit
+ case MIR_DataType::MIR_SIGNED_INT8:
+ return (std::numeric_limits::max)();
+
+ //8 bytes should be sufficient for rest of the types.
+ default:
+ return (std::numeric_limits::max)();
+ }
+}
+
+MIR_InterpolationMethod GetInterpMethod(const GDALRIOResampleAlg& resampleAlgo)
+{
+ switch (resampleAlgo)
+ {
+ case GDALRIOResampleAlg::GRIORA_NearestNeighbour:
+ return MIR_InterpolationMethod::Interp_Nearest;
+ case GDALRIOResampleAlg::GRIORA_Bilinear:
+ return MIR_InterpolationMethod::Interp_Linear;
+ case GDALRIOResampleAlg::GRIORA_Cubic:
+ return MIR_InterpolationMethod::Interp_Cubic;
+ case GDALRIOResampleAlg::GRIORA_CubicSpline:
+ return MIR_InterpolationMethod::Interp_CubicOperator;
+ default:
+ return MIR_InterpolationMethod::Interp_Default;
+ }
+}
+
+CPLErr MIRReadBlock(const uint32_t& nItHandle, const uint32_t& nBand, const int64_t& nCellX, const int64_t& nCellY,
+ const int& nBlockXSize, const int& nBlockYSize, const MIR_DataType& nDataType, const uint32_t& nSizeInByte, void* pImage, const double& dNoDataValue)
+{
+ uint8_t *pszRecord = nullptr;
+ uint8_t *pszValid = nullptr;
+
+ if (SDKDynamicImpl::Get().RBIGetBlock()(nItHandle, nBand, nCellX, nCellY, nBlockXSize, nBlockYSize, &pszRecord, &pszValid, nDataType, true) == MIRSuccess)
+ {
+ FilterDataArray(nBlockXSize, nBlockYSize, pszRecord, pszValid, nDataType, dNoDataValue);
+
+ uint8_t *pDstImage = (uint8_t *)pImage;
+ uint8_t *pSrcImage = (uint8_t *)pszRecord + nBlockXSize * (nBlockYSize)*nSizeInByte;
+
+ for (int nY = 0; nY < nBlockYSize; nY++)
+ {
+ pSrcImage -= nBlockXSize * nSizeInByte;
+ memcpy(pDstImage, pSrcImage, nBlockXSize*nSizeInByte);
+ pDstImage += nBlockXSize * nSizeInByte;
+ }
+
+ SDKDynamicImpl::Get().ReleaseData()(&pszRecord);
+ SDKDynamicImpl::Get().ReleaseData()(&pszValid);
+ }
+
+ return CE_None;
+}
+
+MRRRasterBand::MRRRasterBand(MRRDataset *pDS, const MIR_FieldType & nType, const int& nFieldIndex, const int& nBandIndex, const int& nLevel,
+ const MIR_DataType& nMirDataType, const GDALDataType& nGDALBandDataType, const int& nXSize, const int& nYSize, const uint32_t& nXBlockSize, const uint32_t& nYBlockSize)
+{
+ this->poDS = pDS;
+ nFieldType = nType;
+ eDataType = nGDALBandDataType;
+
+ nRasterXSize = nXSize;
+ nRasterYSize = nYSize;
+
+ nBlockXSize = nXBlockSize;
+ nBlockYSize = nYBlockSize;
+
+ nField = nFieldIndex;
+ nMRRBandIndex = nBandIndex;
+ nEvent = 0;
+
+ nXBlocksCount = (uint32_t)ceil((double)(nRasterXSize * 1.0 / nBlockXSize));
+ nYBlocksCount = (uint32_t)ceil((double)(nRasterYSize * 1.0 / nBlockYSize));
+ nXBlocksCount = nXBlocksCount == 0 ? 1 : nXBlocksCount;
+ nYBlocksCount = nYBlocksCount == 0 ? 1 : nYBlocksCount;
+
+ nResolution = nLevel;
+ nMIRDataType = nMirDataType;
+ nSizeInBytes = SDKDynamicImpl::Get().DataTypeSizeInBytes()(nMirDataType);
+
+ pStatistics = nullptr;
+ bIteratorInitialized = false;
+ nIteratorHandle = 0;
+
+ SetNoDataValue(DataTypeNoDataVal(nMIRDataType));
+
+ //In case of base level define overviews.
+ if (nLevel == 0)
+ {
+ auto nLevels = SDKDynamicImpl::Get().InfoLevelCount()(pDS->nInfoHandle, nField, nEvent);
+ for (uint32_t nL = 1; nL < nLevels; nL++)
+ {
+ SMIR_LevelInfo* pLevelInfo = nullptr;
+ SDKDynamicImpl::Get().LevelInfo()(pDS->nInfoHandle, nField, nEvent, nL, &pLevelInfo);
+ if (pLevelInfo)
+ {
+ auto nLevelWidth = pLevelInfo->nCellBBoxXMax - pLevelInfo->nCellBBoxXMin;
+ auto nLevelHeight = pLevelInfo->nCellBBoxYMax - pLevelInfo->nCellBBoxYMin;
+
+ auto nLevelBlockSizeX = nBlockXSize > nLevelWidth ? nLevelWidth : nBlockXSize;
+ auto nLevelBlockSizeY = nBlockYSize > nLevelHeight ? nLevelHeight : nBlockYSize;
+
+ vOverviewBands.push_back(std::unique_ptr(new MRRRasterBand(pDS, nType, nField, nBandIndex, nL, nMirDataType, nGDALBandDataType,
+ (int)nLevelWidth, (int)nLevelHeight, (uint32_t)nLevelBlockSizeX, (uint32_t)nLevelBlockSizeY)));
+ }
+ }
+ }
+}
+
+MRRRasterBand::~MRRRasterBand()
+{
+ ReleaseStats();
+
+ ReleaseIterator();
+}
+
+GDALRasterBand *MRRRasterBand::GetOverview(int iOverview)
+{
+ if (iOverview >= 0 && iOverview < (int)vOverviewBands.size() && vOverviewBands[iOverview].get())
+ return vOverviewBands[iOverview].get();
+ else
+ return nullptr;
+}
+
+bool MRRRasterBand::BeginIterator()
+{
+ if (bIteratorInitialized)
+ return true;
+
+ bIteratorInitialized = SDKDynamicImpl::Get().RBIBeginRead()(((MRRDataset *)poDS)->GetDSHandle(), GetIterator(), nField, INTPTR_MIN, INTPTR_MAX, nResolution, false) == MIRSuccess;
+
+ return bIteratorInitialized;
+}
+
+bool MRRRasterBand::ReleaseIterator()
+{
+ if (bIteratorInitialized)
+ return (SDKDynamicImpl::Get().RBIEnd()(GetIterator()) == MIRSuccess);
+
+ bIteratorInitialized = false;
+
+ return true;
+}
+
+void MRRRasterBand::ReleaseStats()
+{
+ if (pStatistics != nullptr)
+ SDKDynamicImpl::Get().ReleaseStatistics()(&pStatistics);
+ pStatistics = nullptr;
+}
+
+CPLErr MRRRasterBand::IReadBlock(int nBlockXOff, int nBlockYOff, void * pImage)
+{
+ CPLErr nResult = CE_Failure;
+
+ if (BeginIterator())
+ {
+ int64_t nCellX = nBlockXOff * nBlockXSize;
+ int64_t nCellY = (nYBlocksCount - nBlockYOff - 1) * nBlockYSize;
+
+ nResult = MIRReadBlock(GetIterator(), MRRBandIndex(), nCellX, nCellY, nBlockXSize, nBlockYSize, nMIRDataType, nSizeInBytes, pImage, GetNoDataValue());
+
+ if (nResult != CE_None)
+ {
+ CPLError(CE_Failure, CPLE_AppDefined, "Unable to read block. \n");
+ }
+ }
+
+ return nResult;
+}
+
+CPLErr MRRRasterBand::IRasterIO(GDALRWFlag eRWFlag,
+ int nXOff, int nYOff,
+ int nXSize, int nYSize, //Source size X and Y
+ void * pData,
+ int nBufXSize, int nBufYSize, //Destination size X and Y
+ GDALDataType eBufType,
+ GSpacing /*nPixelSpace*/, GSpacing /*nLineSpace*/,
+ GDALRasterIOExtraArg* psExtraArg)
+{
+ if (eRWFlag == GF_Write)
+ return CE_Failure;
+
+ /* if (nPixelSpace != (GDALGetDataTypeSize(eBufType) / 8))
+ return GDALRasterBand::IRasterIO(eRWFlag,
+ nXOff, nYOff, nXSize, nYSize,
+ pData, nBufXSize, nBufYSize,
+ eBufType,
+ nPixelSpace, nLineSpace,
+ psExtraArg); */
+
+ int nMRRXOffset = nXOff + (int)((MRRDataset*)poDS)->nCellAtGridOriginX;
+ int nMRRRYOffset = ((MRRDataset*)poDS)->nRasterYSize - nYOff - nYSize + (int)((MRRDataset*)poDS)->nCellAtGridOriginY;
+ MIR_InterpolationMethod nInterpMethod = psExtraArg != nullptr ? GetInterpMethod(psExtraArg->eResampleAlg) : MIR_InterpolationMethod::Interp_Default;
+
+ /*
+ if (nPixelSpace == 0)
+ nPixelSpace = GDALGetDataTypeSize(eBufType) / 8;
+
+ if (nLineSpace == 0)
+ nLineSpace = nPixelSpace * nBufXSize;
+ */
+
+ CPLDebug("MRRRasterBand",
+ "RasterIO(nBand=%d,nlevel=%d,nXOff=%d,nYOff=%d,nXSize=%d,nYSize=%d -> %dx%d)",
+ MRRBandIndex(), nResolution, nXOff, nYOff, nXSize, nYSize, nBufXSize, nBufYSize);
+
+ uint8_t* pDataArray = nullptr;
+ uint8_t* pValidArray = nullptr;
+
+ auto nDataType = ConvertToMIRDataTypes(eBufType);
+
+ auto nSizeInByte = GDALGetDataTypeSize(eBufType) / 8;
+ if (nSizeInByte == SDKDynamicImpl::Get().DataTypeSizeInBytes()(nDataType))
+ {
+ if (SDKDynamicImpl::Get().PopulateCellBlock()(((MRRDataset*)poDS)->GetDSHandle(), &pDataArray, &pValidArray, nDataType,
+ nMRRXOffset, nMRRRYOffset, nXSize, nYSize, nBufXSize, nBufYSize, nField, MRRBandIndex(), nInterpMethod,
+ std::numeric_limits::lowest(), (std::numeric_limits::max)()) == MIRSuccess)
+ {
+ auto dNoDataValue = GetNoDataValue();
+ FilterDataArray(nBufXSize, nBufYSize, pDataArray, pValidArray, nDataType, dNoDataValue);
+
+ uint8_t *pDstImage = (uint8_t *)pData;
+ uint8_t *pSrcImage = (uint8_t *)pDataArray + nBufXSize * (nBufYSize)*nSizeInByte;
+
+ for (int nY = 0; nY < nBufYSize; nY++)
+ {
+ pSrcImage -= nBufXSize * nSizeInByte;
+ memcpy(pDstImage, pSrcImage, nBufXSize*nSizeInByte);
+ pDstImage += nBufXSize * nSizeInByte;
+ }
+
+ SDKDynamicImpl::Get().ReleaseData()(&pDataArray);
+ SDKDynamicImpl::Get().ReleaseData()(&pValidArray);
+
+ return CE_None;
+ }
+ }
+
+ return CE_Failure;
+}
+
+bool MRRRasterBand::StatisticsEnsureInitialized(bool bSummary, int bApproxOk, CPL_UNUSED bool bCompute, int nBins)
+{
+ bool bResult = true;
+ int nBuckets = nBins == 0 ? (int)InvalidBinCount : nBins;
+
+ //Check if we need to initialize
+ if (GetStats() == nullptr || (GetStats() != nullptr && (int)GetStats()->cEWHistogram.nBinCount != nBuckets && nBuckets != (int)InvalidBinCount))
+ {
+ //Release statistics if required.
+ ReleaseStats();
+
+ auto nStatsMode = MIR_StatisticsMode::MIR_StatsMode_Distribution;
+ if (bSummary)
+ {
+ nStatsMode = MIR_StatisticsMode::MIR_StatsMode_Summary;
+ }
+
+ if (SDKDynamicImpl::Get().GetStatistics()(((MRRDataset*)poDS)->GetDSHandle(), nField, MRRBandIndex(), nResolution, &pStatistics,
+ nStatsMode, false, nBuckets, InvalidTracker) == MIRSuccess)
+ {
+ bResult = true;
+ }
+ else
+ {
+ uint64_t nBaseLevelCellCount = ((MRRDataset*)poDS)->nRasterXSize * ((MRRDataset*)poDS)->nRasterYSize;
+ bool bSmall = (nBaseLevelCellCount < (uint64_t(1) << (20)));
+ if (bSmall)
+ {
+ if (SDKDynamicImpl::Get().GetStatistics()(((MRRDataset *)poDS)->GetDSHandle(), nField, MRRBandIndex(), nResolution, &pStatistics,
+ MIR_StatisticsMode::MIR_StatsMode_Distribution, true, nBuckets, InvalidTracker) == MIRSuccess)
+ bResult = true;
+ }
+ else if (bApproxOk == 1)
+ {
+ int nApproxHighResolution = SDKDynamicImpl::Get().InfoLevelCount()(((MRRDataset *)poDS)->GetInfoHandle(), nField, nEvent);
+
+ for (; nApproxHighResolution >= 0; --nApproxHighResolution)
+ {
+ SMIR_LevelInfo *pLevelInfo = nullptr;
+ SDKDynamicImpl::Get().LevelInfo()(((MRRDataset *)poDS)->GetDSHandle(), nField, nEvent, nApproxHighResolution, &pLevelInfo);
+ auto nXSize = pLevelInfo->nCellBBoxXMax - pLevelInfo->nCellBBoxXMin;
+ auto nYSize = pLevelInfo->nCellBBoxYMax - pLevelInfo->nCellBBoxYMin;
+
+ // Statistics come from lower resolution levels that have 1M cells or more
+ if (nXSize*nYSize >= 1048576)
+ break;
+ }
+
+ if (SDKDynamicImpl::Get().ComputeStatistics()(((MRRDataset *)poDS)->GetDSHandle(), nField, MRRBandIndex(), nApproxHighResolution,
+ std::numeric_limits::lowest(), (std::numeric_limits::max)(), &pStatistics, nStatsMode, nBuckets, InvalidTracker) == MIRSuccess)
+ bResult = true;
+ }
+ }
+
+ if (!pStatistics || pStatistics->nStatMode == MIR_StatisticsMode::MIR_StatsMode_None)
+ if (SDKDynamicImpl::Get().GetStatistics()(((MRRDataset *)poDS)->GetDSHandle(), nField, MRRBandIndex(), nResolution, &pStatistics, nStatsMode, true, nBuckets, InvalidTracker) == MIRSuccess)
+ bResult = false;
+ }
+
+ return bResult;
+}
+
+double MRRRasterBand::GetMinimum(int* pbSuccess)
+{
+ //Initialize if required
+ StatisticsEnsureInitialized(true, 0);
+
+ if (GetStats())
+ {
+ if (pbSuccess)
+ *pbSuccess = TRUE;
+ return GetStats()->dMin;
+ }
+ return GDALPamRasterBand::GetMinimum(pbSuccess);
+}
+
+double MRRRasterBand::GetMaximum(int* pbSuccess)
+{
+ //Initialize if required
+ StatisticsEnsureInitialized(true, 0);
+
+ if (GetStats())
+ {
+ if (pbSuccess)
+ *pbSuccess = TRUE;
+ return GetStats()->dMax;
+ }
+ return GDALPamRasterBand::GetMaximum(pbSuccess);
+}
+
+CPLErr MRRRasterBand::ComputeRasterMinMax(int bApproxOK, double* adfMinMax)
+{
+ //Initialize if required
+ StatisticsEnsureInitialized(true, bApproxOK);
+
+ int bSuccessMin, bSuccessMax;
+
+ double dfMin = GetMinimum(&bSuccessMin);
+ double dfMax = GetMaximum(&bSuccessMax);
+
+ if (bSuccessMin && bSuccessMax)
+ {
+ adfMinMax[0] = dfMin;
+ adfMinMax[1] = dfMax;
+ return CE_None;
+ }
+
+ return CE_Failure;
+}
+
+CPLErr MRRRasterBand::GetStatistics(int bApproxOK, int bForce,
+ double *pdfMin, double *pdfMax,
+ double *pdfMean, double *padfStdDev)
+{
+ StatisticsEnsureInitialized(true, bApproxOK, bForce != 0);
+
+ if (GetStats())
+ {
+ if (pdfMin)
+ *pdfMin = GetStats()->dMin;
+ if (pdfMax)
+ *pdfMax = GetStats()->dMax;
+ if (pdfMean)
+ *pdfMean = GetStats()->dMean;
+ if (padfStdDev)
+ *padfStdDev = GetStats()->dStdDev;
+
+ return CE_None;
+ }
+
+ if (!bForce && bApproxOK)
+ return CE_Warning;
+ else
+ return CE_Failure;
+}
+
+CPLErr MRRRasterBand::ComputeStatistics(int bApproxOK,
+ double *pdfMin, double *pdfMax,
+ double *pdfMean, double *pdfStdDev,
+ GDALProgressFunc, CPL_UNUSED void *pProgressData)
+{
+ StatisticsEnsureInitialized(true, bApproxOK);
+
+ if (GetStats())
+ {
+ if (pdfMin)
+ *pdfMin = GetStats()->dMin;
+ if (pdfMax)
+ *pdfMax = GetStats()->dMax;
+ if (pdfMean)
+ *pdfMean = GetStats()->dMean;
+ if (pdfStdDev)
+ *pdfStdDev = GetStats()->dStdDev;
+
+ return CE_None;
+ }
+
+ return CE_Warning;
+}
+
+CPLErr MRRRasterBand::GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig ** ppanHistogram,
+ int bForce, GDALProgressFunc pfnProgress, void *pProgressData)
+{
+ StatisticsEnsureInitialized(false, 0, bForce != 0);
+
+ if (GetStats())
+ {
+ if (pdfMin)
+ *pdfMin = GetStats()->dMin;
+ if (pdfMax)
+ *pdfMax = GetStats()->dMax;
+
+ *pnBuckets = GetStats()->cEWHistogram.nBinCount;
+
+ *ppanHistogram = (GUIntBig *)CPLCalloc(sizeof(GUIntBig), *pnBuckets);
+
+ for (size_t i = 0; i < (size_t)*pnBuckets; i++) {
+ (*ppanHistogram)[i] = (GUIntBig)GetStats()->cEWHistogram.pvcBins[i].dCount;
+ }
+
+ return CE_None;
+ }
+
+ return GDALPamRasterBand::GetDefaultHistogram(pdfMin, pdfMax,
+ pnBuckets, ppanHistogram,
+ bForce,
+ pfnProgress,
+ pProgressData);
+}
+
+/*
+ In case of Imagery MRR
+ If band count is >= 4, we mount 3 bands starting from 1st index, so 1st is a red band.
+ If there is only one band in imagery raster, we mount 0th band and that would be Gray.
+*/
+GDALColorInterp MRRRasterBand::GetColorInterpretation()
+{
+ switch (nFieldType)
+ {
+ case MIR_FieldType::MIR_FIELD_Continuous:
+ return GDALColorInterp::GCI_Undefined;
+
+ case MIR_FieldType::MIR_FIELD_Image:
+ {
+ switch (MRRBandIndex())
+ {
+ case 0:
+ return GDALColorInterp::GCI_GrayIndex;
+ case 1:
+ return GDALColorInterp::GCI_RedBand;
+ case 2:
+ return GDALColorInterp::GCI_GreenBand;
+ case 3:
+ return GDALColorInterp::GCI_BlueBand;
+ default:
+ return GDALColorInterp::GCI_Undefined;
+ }
+ }
+ break;
+
+ case MIR_FieldType::MIR_FIELD_ImagePalette:
+ case MIR_FieldType::MIR_FIELD_Classified:
+ return GDALColorInterp::GCI_PaletteIndex;
+
+ default:
+ return GDALColorInterp::GCI_Undefined;
+ }
+}
+
+GDALColorTable* MRRRasterBand::GetColorTable()
+{
+ return ((MRRDataset *)poDS)->GetColorTable();
+}
+
+char** MRRRasterBand::GetCategoryNames()
+{
+ if (nFieldType != MIR_FieldType::MIR_FIELD_Classified)
+ return nullptr;
+
+ return ((MRRDataset *)poDS)->GetCategoryNames(nField);
+}
diff --git a/gdal/frmts/mrr/MRRRasterBand.h b/gdal/frmts/mrr/MRRRasterBand.h
new file mode 100644
index 000000000000..1422178fce1a
--- /dev/null
+++ b/gdal/frmts/mrr/MRRRasterBand.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#include "APIDef.h"
+#include
+
+class MRRDataset;
+
+class MRRRasterBand : public GDALPamRasterBand
+{
+private:
+ friend class MRRRasterDataset;
+ MIR_FieldType nFieldType; //Field type this band belongs to
+ uint32_t nEvent; //zero based EventIndex of MRR this band belongs to.
+ uint32_t nField; //zero based FieldIndex of MRR this band belongs to.
+ uint32_t nMRRBandIndex; //zero based bandIndex (as per MRR SDK).
+ uint32_t nResolution; //zero based level index.
+ MIR_DataType nMIRDataType; //GDAL compatible data type
+ uint32_t nSizeInBytes;
+ SMIR_Statistics* pStatistics;
+ bool bIteratorInitialized; //flag to indicate whether iterator has been initialized
+ uint32_t nIteratorHandle;
+ int nOverviewLevel;
+ std::vector> vOverviewBands; //store overviews.
+ uint32_t nXBlocksCount;
+ uint32_t nYBlocksCount;
+
+ //Private Methods
+ const uint32_t& MRRBandIndex() { return nMRRBandIndex; }
+ unsigned int& GetIterator() { return nIteratorHandle; }
+ bool BeginIterator();
+ bool ReleaseIterator();
+ bool StatisticsEnsureInitialized(bool bSummary, int bApproxOk, bool bCompute = true, int nBins = 0);
+ const SMIR_Statistics* GetStats() const { return pStatistics; }
+ void ReleaseStats();
+
+ CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
+ GDALDataType, GSpacing nPixelSpace, GSpacing nLineSpace, GDALRasterIOExtraArg* psExtraArg) override;
+
+ CPLErr IReadBlock(int, int, void *) override;
+
+public:
+
+ MRRRasterBand(MRRDataset *, const MIR_FieldType &, const int& nFieldIndex, const int& nBandIndex, const int& nOverview,
+ const MIR_DataType& nMIRDataType, const GDALDataType& nGDALDataType, const int&, const int&, const uint32_t&, const uint32_t&);
+ ~MRRRasterBand();
+
+ //Statistics related method
+ double GetMinimum(int *pbSuccess = nullptr) override;
+ double GetMaximum(int *pbSuccess = nullptr) override;
+ CPLErr ComputeRasterMinMax(int, double*) override;
+ CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin, double *pdfMax, double *pdfMean, double *padfStdDev) override;
+ CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData) override;
+ CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig ** ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData) override;
+
+ //Color table related methods
+ GDALColorInterp GetColorInterpretation() override;
+ GDALColorTable* GetColorTable() override;
+ char** GetCategoryNames() override;
+
+ //Overview related method
+ int HasArbitraryOverviews() override { return vOverviewBands.size() != 0; }
+ int GetOverviewCount() override { return (int)vOverviewBands.size(); }
+ GDALRasterBand* GetOverview(int) override;
+};
diff --git a/gdal/frmts/mrr/MRRSDKImpl.cpp b/gdal/frmts/mrr/MRRSDKImpl.cpp
new file mode 100644
index 000000000000..4580b670806c
--- /dev/null
+++ b/gdal/frmts/mrr/MRRSDKImpl.cpp
@@ -0,0 +1,175 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#include "MRRSDKImpl.h"
+
+#if defined(_WIN32) || defined(WIN32)
+#define MIRASTER_SDK_DLL "MIRasterAPIRT.dll"
+#else
+#define MIRASTER_SDK_DLL "libMIRasterAPIRT.so"
+#endif
+
+SDKDynamicImpl* SDKDynamicImpl::m_pSDKImpl = nullptr;
+
+// cppcheck-suppress uninitMemberVarPrivate
+SDKDynamicImpl::SDKDynamicImpl() : m_hMIRasterSDKInstance(nullptr)
+{
+ ClearAll();
+}
+
+SDKDynamicImpl::~SDKDynamicImpl()
+{
+ Release();
+}
+
+SDKDynamicImpl& SDKDynamicImpl::Get()
+{
+ if (!m_pSDKImpl)
+ m_pSDKImpl = new SDKDynamicImpl();
+
+ return *m_pSDKImpl;
+}
+
+bool SDKDynamicImpl::Init()
+{
+ //If SDK is already loaded no need to load it again
+ if (m_hMIRasterSDKInstance != nullptr)
+ return true;
+
+ //Load APIRT.dll
+ {
+#if defined(_WIN32) || defined(WIN32)
+ m_hMIRasterSDKInstance = LoadLibrary(MIRASTER_SDK_DLL);
+#else
+ m_hMIRasterSDKInstance = dlopen(MIRASTER_SDK_DLL, RTLD_LAZY);
+#endif
+ }
+
+ if (m_hMIRasterSDKInstance == nullptr) {
+ return false;
+ }
+
+ //resolve function address here
+ {
+ //Use non-Handler version of methods
+ m_fpOpenRaster_ReadOnly = (pOpenRaster_ReadOnly)GetProcAddress(m_hMIRasterSDKInstance, "MIR_OpenRasterReadOnly");
+ m_fpGetStatistics = (pGetStatistics)GetProcAddress(m_hMIRasterSDKInstance, "MIR_GetStatistics");
+ m_fpComputeStatistics = (pComputeStatistics)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ComputeStatistics");
+ m_fpVerifyRaster = (pVerifyRaster)GetProcAddress(m_hMIRasterSDKInstance, "MIR_VerifyRaster");
+ m_fpReleaseData = (pReleaseData)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ReleaseData");
+ m_fpReleaseRasterInfo = (pReleaseRasterInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ReleaseRasterInfo");
+ m_fpReleaseStatistics = (pReleaseStatistics)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ReleaseStatistics");
+ m_fpGetOpenInfo = (pGetOpenInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_GetOpenInfo");
+ m_fpRasterInfo = (pRasterInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_RasterInfo");
+ m_fpCloseRaster = (pCloseRaster)GetProcAddress(m_hMIRasterSDKInstance, "MIR_CloseRaster");
+ m_fpGetCellSize = (pGetCellSize)GetProcAddress(m_hMIRasterSDKInstance, "MIR_GetCellSize");
+ m_fpPopulateCellBlock = (pPopulateCellBlock)GetProcAddress(m_hMIRasterSDKInstance, "MIR_PopulateCellBlock");
+ m_fpFieldInfo = (pFieldInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_FieldInfo");
+ m_fpInfoLevelCount = (pInfoLevelCount)GetProcAddress(m_hMIRasterSDKInstance, "MIR_InfoLevelCount");
+ m_fpLevelInfo = (pLevelInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_LevelInfo");
+ m_fpInfoBandCount = (pInfoBandCount)GetProcAddress(m_hMIRasterSDKInstance, "MIR_InfoBandCount");
+ m_fpBandInfo = (pBandInfo)GetProcAddress(m_hMIRasterSDKInstance, "MIR_BandInfo");
+ m_fpDataTypeSizeInBytes = (pDataTypeSizeInBytes)GetProcAddress(m_hMIRasterSDKInstance, "MIR_DataTypeSizeInBytes");
+
+ m_fpClassTableGetRecordCount = (pClassTableGetRecordCount)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ClassTableGetRecordCount");
+ m_fpClassTableGetRecord = (pClassTableGetRecord)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ClassTableGetRecord");
+ m_fpClassTableFindField = (pClassTableFindField)GetProcAddress(m_hMIRasterSDKInstance, "MIR_ClassTableFindField");
+
+ m_fpRBIBeginRead = (pRBIBeginRead)GetProcAddress(m_hMIRasterSDKInstance, "MIR_RBI_BeginRead");
+ m_fpRBIEnd = (pRBIEnd)GetProcAddress(m_hMIRasterSDKInstance, "MIR_RBI_End");
+ m_fpRBIGetBlock = (pRBIGetBlock)GetProcAddress(m_hMIRasterSDKInstance, "MIR_RBI_GetBlock");
+ }
+
+ if (!IsAllValid())
+ return false;
+
+ return true;
+}
+
+/*
+ Release resource
+*/
+
+bool SDKDynamicImpl::Release()
+{
+#if defined(_WIN32) || defined(WIN32)
+ bool bRet = FreeLibrary(m_hMIRasterSDKInstance) == TRUE;
+#else
+ bool bRet = dlclose(m_hMIRasterSDKInstance);
+#endif
+ m_hMIRasterSDKInstance = nullptr;
+
+ ClearAll();
+
+ return bRet;
+}
+
+void SDKDynamicImpl::ClearAll()
+{
+ m_fpOpenRaster_ReadOnly = nullptr;
+ m_fpGetStatistics = nullptr;
+ m_fpComputeStatistics = nullptr;
+ m_fpVerifyRaster = nullptr;
+ m_fpReleaseData = nullptr;
+ m_fpReleaseRasterInfo = nullptr;
+ m_fpReleaseStatistics = nullptr;
+ m_fpGetOpenInfo = nullptr;
+ m_fpRasterInfo = nullptr;
+ m_fpCloseRaster = nullptr;
+ m_fpGetCellSize = nullptr;
+ m_fpPopulateCellBlock = nullptr;
+ m_fpFieldInfo = nullptr;
+ m_fpInfoLevelCount = nullptr;
+ m_fpLevelInfo = nullptr;
+ m_fpInfoBandCount = nullptr;
+ m_fpBandInfo = nullptr;
+ m_fpRBIBeginRead = nullptr;
+ m_fpRBIEnd = nullptr;
+ m_fpRBIGetBlock = nullptr;
+ m_fpDataTypeSizeInBytes = nullptr;
+ m_fpClassTableGetRecordCount = nullptr;
+ m_fpClassTableGetRecord = nullptr;
+ m_fpClassTableFindField = nullptr;
+}
+
+bool SDKDynamicImpl::IsAllValid()
+{
+ //if Any of the pointers is not initialized return false
+ if (m_fpOpenRaster_ReadOnly == nullptr ||
+ m_fpGetStatistics == nullptr ||
+ m_fpComputeStatistics == nullptr ||
+ m_fpVerifyRaster == nullptr ||
+ m_fpReleaseData == nullptr ||
+ m_fpReleaseRasterInfo == nullptr ||
+ m_fpReleaseStatistics == nullptr ||
+ m_fpGetOpenInfo == nullptr ||
+ m_fpRasterInfo == nullptr ||
+ m_fpCloseRaster == nullptr ||
+ m_fpGetCellSize == nullptr ||
+ m_fpFieldInfo == nullptr ||
+ m_fpInfoLevelCount == nullptr ||
+ m_fpLevelInfo == nullptr ||
+ m_fpInfoBandCount == nullptr ||
+ m_fpBandInfo == nullptr ||
+ m_fpRBIBeginRead == nullptr ||
+ m_fpRBIEnd == nullptr ||
+ m_fpRBIGetBlock == nullptr ||
+ m_fpDataTypeSizeInBytes == nullptr ||
+ m_fpClassTableGetRecordCount == nullptr ||
+ m_fpClassTableGetRecord == nullptr ||
+ m_fpClassTableFindField == nullptr)
+ return false;
+
+ return true;
+}
diff --git a/gdal/frmts/mrr/MRRSDKImpl.h b/gdal/frmts/mrr/MRRSDKImpl.h
new file mode 100644
index 000000000000..55d821e1862e
--- /dev/null
+++ b/gdal/frmts/mrr/MRRSDKImpl.h
@@ -0,0 +1,152 @@
+/*****************************************************************************
+* Copyright 2016, 2020 Precisely.
+*
+* Licensed under the MIT License (the “License”); you may not use this file
+* except in the compliance with the License.
+* You may obtain a copy of the License at https://opensource.org/licenses/MIT
+
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an “AS IS” WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*****************************************************************************/
+
+#pragma once
+#ifndef __SDKDYNAMICIMPL_H_
+#define __SDKDYNAMICIMPL_H_
+
+#include "APIDef.h"
+#if defined(_WIN32) || defined(WIN32)
+#include
+#else
+#include
+#define HINSTANCE void*
+#define GetProcAddress(x,y) dlsym(x,y)
+#endif
+
+/*
+ Responsible for Raster SDK dynamic loading.
+*/
+class SDKDynamicImpl
+{
+private:
+ //If any change happens in the signature of these API's we need to reflect that here
+ //Resource management
+ typedef MIRResult(*pReleaseStatistics) (SMIR_Statistics** ppStats);
+ typedef MIRResult(*pReleaseData) (uint8_t** ppData);
+ typedef MIRResult(*pReleaseRasterInfo) (uint32_t nInfoHandle);
+
+ // Dataset access
+ typedef MIRResult(*pVerifyRaster) (const wchar_t* pwsFilePath);
+ typedef MIRResult(*pOpenRaster_ReadOnly) (const wchar_t* pwsFilePath, uint32_t& nRasterHandle, MIR_RasterSupportMode eRasterSupportMode, MIR_FieldType eMountAsFieldType, uint32_t nProgressTrackerHandle);
+ typedef MIRResult(*pGetStatistics) (uint32_t nRasterHandle, uint32_t nField, uint32_t nBand, int32_t nResolution, SMIR_Statistics** ppStats,
+ MIR_StatisticsMode nMode, bool bRecalculate_if_invalid, uint32_t nBinCount, uint32_t nProgressTrackerHandle);
+ typedef MIRResult(*pComputeStatistics) (uint32_t nRasterHandle, uint32_t nField, uint32_t nBand, int32_t nResolution, time_t nFirstTime, time_t nLastTime,
+ SMIR_Statistics** ppStats, MIR_StatisticsMode nMode, uint32_t nBinCount, uint32_t nProgressTrackerHandle);
+ typedef MIRResult(*pCloseRaster) (uint32_t nRasterHandle, SMIR_FinalisationOptions* pFinalise, uint32_t nProgressTrackerHandle);
+ //Iterator
+ typedef MIRResult(*pRBIBeginRead) (uint32_t nRasterHandle, uint32_t& nItHandle, uint32_t nField, time_t nStartTime, time_t nEndTime, int32_t nResolution, bool bGridCellCoords);
+ typedef MIRResult(*pRBIEnd) (uint32_t nItHandle);
+ typedef MIRResult(*pRBIGetBlock) (uint32_t nItHandle, uint32_t nBand, int64_t nCellX, int64_t nCellY, uint32_t nWidth, uint32_t nHeight, uint8_t** ppDataArray, uint8_t** ppValidArray, MIR_DataType nDataType, bool bUnloadTiles);
+
+ //Dataset field information
+ typedef MIRResult(*pGetCellSize) (uint32_t nRasterHandle, uint32_t nField, int32_t nResolution, double& dCellX, double& dCellY);
+ typedef MIRResult(*pGetOpenInfo) (uint32_t nRasterHandle, uint32_t& nInfoHandle, uint32_t nProgressTrackerHandle);
+
+ // Acquire raster info data for get/set
+ typedef MIRResult(*pRasterInfo) (uint32_t nInfoHandle, SMIR_RasterInfo** ppRasterInfo);
+ typedef MIRResult(*pFieldInfo) (uint32_t nInfoHandle, uint32_t nField, SMIR_FieldInfo** ppFieldInfo);
+ typedef unsigned int(*pInfoBandCount) (uint32_t nInfoHandle, uint32_t nField);
+ typedef MIRResult(*pBandInfo) (uint32_t nInfoHandle, uint32_t nField, uint32_t nBand, SMIR_BandInfo** ppBandInfo);
+ typedef unsigned int(*pInfoLevelCount) (uint32_t nInfoHandle, uint32_t nField, uint32_t nEvent);
+ typedef MIRResult(*pLevelInfo) (uint32_t nInfoHandle, uint32_t nField, uint32_t nEvent, uint32_t nLevel, SMIR_LevelInfo** ppLevelInfo);
+
+ typedef MIRResult(*pSetCacheSize) (uint64_t nCacheSizeMB);
+ typedef int(*pDataTypeSize_InBytes) (MIR_DataType nDataType);
+ typedef MIRResult(*pPopulateCellBlock) (uint32_t nRasterHandle, uint8_t** ppData, uint8_t** ppValid, MIR_DataType nDestDataType,
+ int64_t nCol, int64_t nRow, uint64_t nCols, uint64_t nRows, uint64_t nDestCols, uint64_t nDestRows,
+ uint32_t nField, uint32_t nBand, MIR_InterpolationMethod nInterpolationMethod,
+ time_t nFirstTime, time_t nLastTime);
+ typedef int32_t(*pDataTypeSizeInBytes) (MIR_DataType nDataType);
+
+ typedef MIRResult(*pClassTableGetRecordCount) (uint32_t nRasterHandle, uint32_t nField, uint32_t& nRecordCount);
+ typedef MIRResult(*pClassTableGetRecord) (uint32_t nRasterHandle, uint32_t nField, uint32_t nTableField, uint32_t nRecord, uint8_t** ppData, MIR_DataType& nDataType, uint32_t& nDataSize);
+ typedef MIRResult(*pClassTableFindField) (uint32_t nRasterHandle, uint32_t nField, MIR_ClassTableFieldType eType, uint32_t& nTableField);
+
+ //function pointers
+ pOpenRaster_ReadOnly m_fpOpenRaster_ReadOnly;
+ pGetStatistics m_fpGetStatistics;
+ pComputeStatistics m_fpComputeStatistics;
+ pReleaseStatistics m_fpReleaseStatistics;
+ pReleaseData m_fpReleaseData;
+ pReleaseRasterInfo m_fpReleaseRasterInfo;
+ pVerifyRaster m_fpVerifyRaster;
+ pGetCellSize m_fpGetCellSize;
+ pGetOpenInfo m_fpGetOpenInfo;
+ pRasterInfo m_fpRasterInfo;
+ pCloseRaster m_fpCloseRaster;
+ pPopulateCellBlock m_fpPopulateCellBlock;
+ pFieldInfo m_fpFieldInfo;
+ pInfoLevelCount m_fpInfoLevelCount;
+ pLevelInfo m_fpLevelInfo;
+ pInfoBandCount m_fpInfoBandCount;
+ pBandInfo m_fpBandInfo;
+ pSetCacheSize m_fpSetCacheSize;
+ pDataTypeSizeInBytes m_fpDataTypeSizeInBytes;
+ pRBIBeginRead m_fpRBIBeginRead;
+ pRBIEnd m_fpRBIEnd;
+ pRBIGetBlock m_fpRBIGetBlock;
+ pClassTableGetRecord m_fpClassTableGetRecord;
+ pClassTableGetRecordCount m_fpClassTableGetRecordCount;
+ pClassTableFindField m_fpClassTableFindField;
+
+ HINSTANCE m_hMIRasterSDKInstance; //handle of the MRR Raster SDK dll.
+ static SDKDynamicImpl* m_pSDKImpl;
+
+ void ClearAll();
+ bool IsAllValid();
+ SDKDynamicImpl();
+ ~SDKDynamicImpl();
+
+public:
+
+ static SDKDynamicImpl& Get();
+
+ bool Init();
+ bool Release();
+
+
+ pOpenRaster_ReadOnly OpenRaster_ReadOnly() { return m_fpOpenRaster_ReadOnly; }
+ pGetStatistics GetStatistics() { return m_fpGetStatistics; }
+ pComputeStatistics ComputeStatistics() { return m_fpComputeStatistics; }
+ pReleaseStatistics ReleaseStatistics() { return m_fpReleaseStatistics; }
+ pReleaseData ReleaseData() { return m_fpReleaseData; }
+ pReleaseRasterInfo ReleaseRasterInfo() { return m_fpReleaseRasterInfo; }
+ pVerifyRaster VerifyRaster() { return m_fpVerifyRaster; }
+ pGetCellSize GetCellSize() { return m_fpGetCellSize; }
+ pGetOpenInfo GetOpenInfo() { return m_fpGetOpenInfo; }
+ pRasterInfo RasterInfo() { return m_fpRasterInfo; }
+ pCloseRaster CloseRaster() { return m_fpCloseRaster; }
+ pPopulateCellBlock PopulateCellBlock() { return m_fpPopulateCellBlock; }
+
+ pFieldInfo FieldInfo() { return m_fpFieldInfo; }
+ pInfoLevelCount InfoLevelCount() { return m_fpInfoLevelCount; }
+ pLevelInfo LevelInfo() { return m_fpLevelInfo; }
+ pInfoBandCount InfoBandCount() { return m_fpInfoBandCount; }
+ pBandInfo BandInfo() { return m_fpBandInfo; }
+ pSetCacheSize SetCacheSize() { return m_fpSetCacheSize; }
+ pDataTypeSizeInBytes DataTypeSizeInBytes() { return m_fpDataTypeSizeInBytes; }
+
+ //Iterator
+ pRBIBeginRead RBIBeginRead() { return m_fpRBIBeginRead; }
+ pRBIEnd RBIEnd() { return m_fpRBIEnd; }
+ pRBIGetBlock RBIGetBlock() { return m_fpRBIGetBlock; }
+
+ //ClassTable methods
+ pClassTableGetRecord ClassTableGetRecord() { return m_fpClassTableGetRecord; }
+ pClassTableGetRecordCount ClassTableGetRecordCount() { return m_fpClassTableGetRecordCount; }
+ pClassTableFindField ClassTableFindField() { return m_fpClassTableFindField; }
+};
+
+#endif
diff --git a/gdal/frmts/mrr/VERSION b/gdal/frmts/mrr/VERSION
new file mode 100644
index 000000000000..f3229c5b9876
--- /dev/null
+++ b/gdal/frmts/mrr/VERSION
@@ -0,0 +1 @@
+..
diff --git a/gdal/frmts/mrr/makefile.vc b/gdal/frmts/mrr/makefile.vc
new file mode 100644
index 000000000000..43c5dec69f53
--- /dev/null
+++ b/gdal/frmts/mrr/makefile.vc
@@ -0,0 +1,25 @@
+
+OBJ = mrrdataset.obj MRRRasterBand.obj MRRSDKImpl.obj
+
+PLUGIN_DLL = gdal_MRR.dll
+
+GDAL_ROOT = ..\..
+
+!INCLUDE $(GDAL_ROOT)\nmake.opt
+
+default: $(OBJ)
+ xcopy /D /Y *.obj ..\o
+
+clean:
+ -del *.obj
+
+plugin: $(PLUGIN_DLL)
+
+$(PLUGIN_DLL): $(OBJ)
+ link /dll $(LDEBUG) /out:$(PLUGIN_DLL) $(OBJ) $(GDAL_ROOT)/gdal_i.lib $(MRR_LIB)
+ if exist $(PLUGIN_DLL).manifest mt -manifest $(PLUGIN_DLL).manifest -outputresource:$(PLUGIN_DLL);2
+
+plugin-install:
+ -mkdir $(PLUGINDIR)
+ $(INSTALL) $(PLUGIN_DLL) $(PLUGINDIR)
+
diff --git a/gdal/gcore/gdal_frmts.h b/gdal/gcore/gdal_frmts.h
index f3a281a80fae..f946e79ad94b 100644
--- a/gdal/gcore/gdal_frmts.h
+++ b/gdal/gcore/gdal_frmts.h
@@ -199,6 +199,7 @@ void CPL_DLL GDALRegister_EEDA(void);
void CPL_DLL GDALRegister_SIGDEM(void);
void CPL_DLL GDALRegister_BYN(void);
void CPL_DLL GDALRegister_IGNFHeightASCIIGrid(void);
+void CPL_DLL GDALRegister_MRR(void);
void CPL_DLL GDALRegister_TileDB(void);
void CPL_DLL GDALRegister_DAAS(void);
void CPL_DLL GDALRegister_COG(void);
diff --git a/gdal/nmake.opt b/gdal/nmake.opt
index 9bfc9503a36b..466f8f0032cd 100644
--- a/gdal/nmake.opt
+++ b/gdal/nmake.opt
@@ -417,6 +417,21 @@ JPEG12_SUPPORTED = 1
# /D_MBCS /D_UNICODE /DUNICODE /D_WINDOWS \
# /DLIBECWJ2 /DWIN32 /D_WINDLL -DNO_X86_MMI
+
+# Uncomment the following line to enable Pitney Bowes MRR support.
+#MRR_ENABLED = YES
+#MRR_VERSION=1
+#MRR_SDK = C:\MRRSDK\sdk
+#MRR_INC = $(MRR_SDK)\include
+#MRR_LIB = $(MRR_SDK)\lib\pe$(MRR_VERSION).lib \
+# $(MRR_SDK)\lib\sde$(MRR_VERSION).lib $(MRR_SDK)\lib\sg$(MRR_VERSION).lib
+
+# To build MRR support as a plugin uncomment the following, and make sure
+# to do "nmake /f makefile.vc plugin" in gdal/frmts/mrr and copy the two
+# resulting DLLs to an appropriate place.
+#MRR_PLUGIN = YES
+
+
# DWG support using the Open Design Alliance Teigha Libraries
# Two versions are supported:
# - ODA >= 2021 (tested with 2021.2), defined immediately
@@ -712,6 +727,7 @@ OCI_INCLUDE = -I$(ORACLE_HOME)\oci\include
!ENDIF
!ENDIF
+
#FGDB_ENABLED = YES
#FGDB_PLUGIN = YES
#FGDB_SDK = C:\Users\rburhum\Desktop\FileGDB_API_VS2008_1_0beta3
@@ -1015,6 +1031,14 @@ ECW_LIB_LINK=
!ENDIF
!ENDIF
+!IFDEF MRR_SDK
+!IF "$(MRR_PLUGIN)" != "YES"
+MRR_LIB_LINK= $(MRR_LIB)
+!ELSE
+MRR_LIB_LINK=
+!ENDIF
+!ENDIF
+
!IFDEF LURATECH_CFLAGS
!IF "$(JP2LURA_PLUGIN)" != "YES"
LURATECH_LIB_LINK= $(LURATECH_LIB)
@@ -1140,7 +1164,7 @@ SYM_PREFIX=_
!ENDIF
EXTERNAL_LIBS = $(OGDILIB) $(XERCES_LIB) $(EXPAT_LIB) $(OCI_LIB) $(PG_LIB) \
- $(KAK_LIB_LINK) $(ECW_LIB_LINK) $(LURATECH_LIB_LINK) $(HDF4_LIB_LINK) $(FME_LIB) $(MRSID_LIB_LINK) \
+ $(KAK_LIB_LINK) $(ECW_LIB_LINK) $(MRR_LIB_LINK) $(LURATECH_LIB_LINK) $(HDF4_LIB_LINK) $(FME_LIB) $(MRSID_LIB_LINK) \
$(FITS_LIB_LINK) $(JPEG_LIB) $(NETCDF_LIB_LINK) $(PROJ4_LIB) \
$(GEOTIFF_LIB) $(TIFF_LIB) $(PROJ_LIBRARY) $(SQLITE_LIB) \
$(MYSQL_LIB) $(GEOS_LIB) $(HDF5_LIB_LINK) $(KEA_LIB_LINK) $(ARCOBJECTS_LIB) $(DWG_LIB_LINK) \