Click or drag to resize

Terrain and Imagery Conversion

AGI's PDTT file format is used for terrain visualization, and the GeoJP2 file format is used for imagery. Insight3D® provides interfaces to create both of these formats.

PDTT File Conversion

AGIProcessedTerrainWriter is used to convert any of the RasterTerrainProvider terrain file formats listed in the Terrain topic.

Some raster terrain providers, such as AGIWorldTerrain, use the Earth's mean sea level as the reference for the terrain heights. See the Terrain topic for more information on obtaining and loading MSL data.

The following code creates a PDTT file containing a section of the AGI World Terrain file.

C#
AGIWorldTerrain sourceTerrain = new AGIWorldTerrain(terrainPath);

CartographicExtent extent = new CartographicExtent(Trig.DegreesToRadians(-105.87), Trig.DegreesToRadians(38.75),
                                                   Trig.DegreesToRadians(-103.87), Trig.DegreesToRadians(40.75));

AGIProcessedTerrainWriter.Write(Earth, sourceTerrain, extent, outputFile, true);
GeoJP2 File Conversion

A GeoJP2 file is a JP2 file with geographic information embedded within. Insight3D requires that the file be in the geographic WGS84 projection. If your JP2 files are already in this format, file conversion is not necessary.

Jpeg2000Writer is used to convert imagery files, such a GeoTIFF, BMP, or JPEG, to a GeoJP2 file. The following example converts a BMP with the extent as input:

C#
Jpeg2000Writer.Write(bmpFile,
                     new CartographicExtent(-1.0, -1.0, 1.0, 1.0),
                     Jpeg2000CompressionProfile.Default,
                     1,
                     outputFile,
                     true);

The following example converts a GeoTIFF image. Note that the extent is not required, since the extent is obtained from the image directly.

C#
Jpeg2000Writer.Write(geotiffFile,
                     Jpeg2000CompressionProfile.Default,
                     1,
                     outputFile,
                     true);
GDAL

If an image conversion fails due to invalid or non-existent extents, but the extents are defined with the image as with a GeoTIFF, you may require additional GDAL data. GDAL is the library that Insight3D uses to read geospatial data and to reproject images.

GDAL data is included in the install in GdalData.zip. Unzip this file into your output directory. Ensure that the Gdal directory is side-by-side with the Insight3D DLL. Then, try to convert your image again.