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.
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.
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(getEarth(), sourceTerrain, extent, outputFile, true);
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:
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.
Jpeg2000Writer.write(geotiffFile, Jpeg2000CompressionProfile.DEFAULT, 1, outputFile, true);
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.