Using External Terrain Data

STK Pro, STK Premium (Air), STK Premium (Space), or STK Enterprise
You can obtain the necessary licenses for this tutorial by contacting AGI Support at support@agi.com or 1-800-924-7244.

The results of the tutorial may vary depending on the user settings and data enabled (online operations, terrain server, dynamic Earth data, etc.). It is acceptable to have different results.

Capabilities covered

This lesson covers the following capability of the Ansys Systems Tool Kit® (STK®) digital mission engineering software:

  • STK Pro

Problem statement

Engineers and analysts need to use external terrain and imagery data for visualization in the STK application. You have many types of terrain and image files available from a variety of sources, but many of those file types are not natively supported for display in the STK application. Additionally, you also want an easy way to create color elevation imagery from your existing terrain data without having that specific imagery at hand.

Solution

Use the STK application's Imagery and Terrain Converter to generate compatible visualization files for display in both the 2D and 3D Graphics windows. Then, use the Create Color Elevation Imagery utility to create a color elevation image from existing terrain data.

What you will learn

Upon completion of this tutorial, you will understand:

  • STK-compatible terrain data and imagery formats
  • How to introduce terrain and elevation data into an STK scenario
  • How to use the Imagery and Terrain Converter
  • How to use the Color Elevation Imagery utility
  • How to load image inlays into both the 2D and 3D Graphics windows

Creating a new scenario

First, you must create a new STK scenario, then build from there.

  1. Launch the STK application ().
  2. Click Create a Scenario in the Welcome to STK dialog box.
  3. Enter the following in the STK: New Scenario Wizard:
  4. Option Value
    Name Mountain
    Location Default
    Start Use the default date / set the time to 19:00.00.000 UTCG
    Stop + 24 hr
  5. Click OK when you finish.
  6. Click Save () when the scenario loads.
  7. The STK software creates a folder with the same name as your scenario for you.

  8. Verify the scenario name and location in the Save As dialog box.
  9. Click Save.

Save () often during this lesson!

Importing terrain data into a scenario

You can use the Scenario object's Terrain properties to specify locally available terrain data files to be used for analysis and visualization in the scenario. You can specify local terrain data for Earth, the Moon, and the traditional planets of the solar system.

Turning off streaming terrain

By default, the STK application connects to the Ansys Geospatial Data Cloud to distribute Earth terrain data for analysis and visualization. Turn off streaming terrain, as you want to use a local file to model the terrain data.

  1. Right-click on Mountain () in the Object Browser.
  2. Select Properties () in the shortcut menu.
  3. Select the Basic - Terrain page when the Properties Browser opens.
  4. Clear the Use terrain server for analysis check box in the Terrain Server panel.
  5. Click Apply to confirm your change and to keep the Properties Browser open.

Using a custom analysis terrain source

Use a preinstalled, medium-resolution, USGS Digital Elevation Model (DEM) file for analysis in your scenario. The USGS Digital Elevation Model is the standard set forth by the US Geological Survey (USGS) for handling digital elevation data for the United States and Puerto Rico. This file contains digital elevation data for Mount St. Helens and the vicinity near the city of Hoquiam, Washington.

  1. Click Add in the Custom Analysis Terrain Sources panel.
  2. Open the file type drop-down list when the Open dialog box opens.
  3. Select USGS DEM (DEM) (*.dem).
  4. Browse to the preinstealled hoquiam-e.dem in <Install Dir>\Data\Resources\stktraining\samples.
  5. Select hoquiam-e.dem.
  6. Click Open to select the file and to close the Open dialog box.
  7. Click OK to confirm your selection and to close the Properties Browser.
  8. Save () your scenario.

Your terrain data are now in your scenario and can be used for analysis. However, you would like to visually see it using custom imagery. You will need to convert it to a format that the STK application can use for display.

Using the Imagery and Terrain Converter

To accommodate 3D rendering performance in a dynamic visualization window when working with imagery, the STK application requires data formats that are optimized for speed and streaming. It utilizes both proprietary formats and the open JPEG 2000 format to accomplish process and render images in the 3D and 2D Graphics window. Tables of the imagery and terrain formats supported by the STK application for visualization are below:

Image Formats Description
PDTTX (*.pdttx) AGI proprietary image format for 3D and 2D Graphics windows
JPEG 2000 (*.jp2) Non-proprietary image format for 3D and 2D Graphics windows
Terrain Formats Description
PDTT (*.pdtt) AGI proprietary terrain inlay for 3D Graphics windows

You can convert external images and terrain files into the compatible formats for visualization described above using the Imagery and Terrain Converter utility, which comes preinstalled with the STK application. If your imagery is already in a natively supported format, such as JPEG 2000, conversion is not necessary. See the workflow diagram below:

Imagery and Terrain Converter workflow

Use the Imagery and Terrain Converter to create an image and a terrain inlay for the 3D Graphics window that will drape a photographic image of Mount St. Helens over analytical terrain.

Opening the Imagery and Terrain Converter

Open the Imagery and Terrain Converter from the Utilities menu.

  1. Select the Utilities menu in the Menu Bar.
  2. Select Imagery and Terrain Converter... in the Utilities menu.

Opening the Single Image Converter

The Single Image Converter creates image files compatible with the STK application from your source images and terrain data. Terrain data are preprocessed using the source images, dramatically improving the rate at which the STK globe file (*.glb) will be rendered in the 3D Graphics window.

  1. Select the Single Image page when the Imagery and Terrain Converter opens.
  2. Click the Image Filename ellipsis () in the Input Data panel.
  3. Browse to <Install Dir>\Data\Resources\stktraining\samples when the File dialog box opens.
  4. Select SpaceImaging St Helens.sid.
  5. SpaceImaging St Helens.sid is a multiresolution seamless image database (MrSID) file, and is courtesy of Space Imaging, Inc.

  6. Click Open to confirm your selection and to close the Open dialog box.

Notice that in the Image Extent panel, the Image fields have been automatically populated with coordinate data. This is because SpaceImaging St Helens.sid contains georeferencing data that the STK application can read, which specify the geographic bounds of the image to be converted. For some types of image files — those that do not contain georeferencing data — you will have to enter the image extents manually.

Using the DEM file for a terrain inlay

Use the preinstalled hoquiam-e.dem terrain data file to create the corresponding terrain inlay (*.pdtt) file for the converted image. Any terrain data set specified at the scenario level can be used.

  1. Select the Use check box in the Terrain panel.
  2. Open the Use drop-down list.
  3. Select Data\Resource\stktraining\samples\hoquiam-e.dem.

Notice that the terrain's extent approximately matches that of the source image. The terrain source used must overlap some region of the image to be converted. Altitudes of zero are inserted wherever the terrain region does not overlap the image.

Setting the image file output data

Select the output options for your converted image and terrain.

  1. Ensure JPEG 2000 Image (jp2) is selected for the Format in the Image File panel.
  2. Select the Compression Ratio option in the JPEG 2000 Compression panel.
  3. The compression profile indicates how the image is compressed. The default method is generally acceptable. Selecting the Compression Ratio option will produce a much smaller compressed file than the Lossless option, which constructs the exact original data from the compressed data. Note that with a compression ratio, the constructed data may be different from the original.

  4. Enter 10 in the x:1 field.
  5. This is ratio of the compressed file to the uncompressed file.

  6. Click the Directory ellipsis () in the Image File panel.
  7. Select the STK User folder in the left navigation pane when the Directory dialog box opens.
  8. Select your scenario folder (for example, Mountain) in the folder and file list.
  9. Click Select Folder to set the directory in which the converted images will be stored and to close the Directory dialog box.
  10. Ensure the Use Output Image Data check box is selected in the Terrain File panel.
  11. This stores the converted terrain file in the same directory as the image file and uses the same base file name as the image file. Note the Directory for both the Image File and the Terrain File are set to your scenario folder path(for example, C:\Users\<username>\STK_ODTK 13\Mountain).

  12. Ensure the Delete Intermediate Terrain File check box is selected.
  13. An intermediate processed terrain file (*.datt) is created whenever a raw terrain source is converted to a terrain file (*.pdtt). This intermediate file is deleted in the conversion process unless the Delete Intermediate Terrain File check box is cleared. The image converted must fall completely within the selected .datt file.

Converting the image and terrain

With your parameters configured, convert the image and terrain for use with the STK application.

  1. Click Convert.
  2. You may have to scroll down in the Imagery and Terrain Converter in order to see the Convert button.

    Converting a MrSID or JPEG 2000 image to a PDTTX file may take a significant amount of time and require a significant amount of temporary disk space, especially when re-projecting to latitude/longitude.

  3. Click Close to close the Imagery and Terrain Converter.

Displaying the imagery and terrain in the 3D Graphics window

You can add your converted imagery and terrain to a globe with the Globe Manager.

Adding the imagery and terrain to the Globe Manager hierarchy

Add the converted image and the terrain source to the 3D Graphics window by updating the Globe Manager hierarchy.

  1. Bring the 3D Graphics window to the front.
  2. Click Globe Manager () on the 3D Graphics window's Globe Manager toolbar.
  3. Click Add Terrain/Imagery () on the Globe Manager Hierarchy toolbar when the Globe Manager window opens.
  4. Select Add Terrain/Imagery... (Add Terrain/Imagery button) in the Add Terrain/Imagery drop-down menu.
  5. Open the Path drop-down list when the Globe Manager: Open Terrain and Imagery Data dialog box opens.
  6. Select your scenario folder (for example, C:\Users\<username>\STK_ODTK 13\Mountain).
  7. Select the check boxes for both SpaceImaging St Helens.jp2 and SpaceImaging St Helens.pdtt.
  8. Click Add.
  9. Click No. when the Use Terrain for Analysis dialog box opens.
  10. You are already using hoquiam-e.dem for analysis.

Viewing the terrain and imagery in the 3D Graphics window

In one action you converted an image and terrain with the same extents.

  1. Select SpaceImaging St Helens.jp2 () in the Globe Manager hierarchy.
  2. Click Zoom To () on the Globe Manager Hierarchy toolbar.
  3. This will take you directly to the image in the 3D Graphics window.

  4. Move around in the 3D Graphics window to get a good view of the terrain and imagery.

3D View: Mount St. Helens

Toggling the extents

You can observe the displayed area of an item in the 3D Graphics window by turning on its extent.

  1. Select SpaceImaging St Helens.jp2 () in the Globe Manager hierarchy.
  2. Click Toggle Extents () on the Globe Manager Hierarchy toolbar.
  3. 3D View: Mount St. Helens WITH image extent toggled on

    SpaceImaging St Helens.jp2 will be highlighted in translucent green in the 3D Graphics window, enabling you to observe its extents. If you select another item in the Globe Manager hierarchy, SpaceImaging St Helens.jp2's extents will be highlighted in white.

  4. Note that an extent indicator () is displayed next to SpaceImaging St Helens.jp2 () in the Globe Manager hierarchy.
  5. Click Toggle Extents () again to turn off the highlighting.

Displaying the image inlay in the 2D Graphics window

Update the 2D Graphics window's Imagery properties to inlay your converted JPEG 2000 image.

  1. Bring the 2D Graphics window to the front.
  2. Click Properties () on the 2D Graphics window's 2D Window Defaults toolbar.
  3. Select the Imagery page when the Properties Browser opens.
  4. Click Add... in the Inlay Images panel.
  5. Browse to your scenario folder when the Map Images dialog box opens, if it does not open in that location automatically.
  6. Select SpaceImaging St Helens.jp2.
  7. Click Open to confirm your selection and to close the Map Images dialog box.
  8. Verify that the Show check box is selected in the Images table.
  9. Select the Show Image Extents check box in the Image Display Options panel.
  10. When selected, this displays a boundary around each imported image in the 2D Graphics window.

  11. Click Apply to confirm your changes and to keep the Properties Browser open.

You can directly inlay the following image formats in a 2D Graphics window: .bmp, .jp2, .pdttx, .png, .ppm, .tif, .toc, .thf, .txm, and .txb.

Viewing the image in the 2D Graphics window

Take a look at the inlaid image in the 2D Graphics window.

  1. Select the SpaceImaging St Helens.jp2 row in the Images table.
  2. Click Zoom To ().
  3. Click OK to close the Properties Browser.
  4. Bring the 2D Graphics window to the front.
  5. Hover over the 2D Graphics window and use the mouse scroll wheel to zoom out until you can see the full extent of the image inlay, which will be bounded by a white rectangle.
  6. 2D View: Mount St. Helens WITH image extent SHOWN

Using the Create Color Elevation Imagery utility

The Create Color Elevation Imagery utility enables you to create images from terrain data that show elevation data colored by height (for example, blue for sea level, green for land, and white for mountain tops). This is useful if you need to visualize terrain but lack imagery or if you want to put the emphasis on height rather than the content of the image. A workflow diagram is below:

Create Color Elevation utility workflow

Opening the Create Color Elevation Imagery utility

Open the Create Color Elevation utility from the Utilities menu.

  1. Select the Utilities menu on the Menu Bar.
  2. Select Create Color Elevation Imagery… in the Utilities menu.

Selecting the terrain region

Choose the terrain region to be converted using the 2D Graphics window.

  1. Ensure the Select On 2D Map check box is selected in the Terrain Region panel when the Create Color Elevation Imagery dialog box opens.
  2. On the 2D Graphics window, using your mouse, click and drag to draw out a rectangle around the extent around the inlaid image of Mount St. Helens.
  3. The South Lat, West Lon, North Lat, and East Lon fields are automatically updated with the coordinates of your bounding box to mark the region to be converted. The STK application uses any valid terrain sets included in the selected region. If more than one terrain set is valid for a region, STK uses the terrain set with the highest resolution of available terrain sets. If the region contains no terrain data, the image will not be created.

    It is likely that when defining your terrain region with the Select On 2D Map option, you will not match the bounds exactly. If precision is preferred, you can manually enter the values for the terrain region to match the extents of the SpaceImaging St Helens.pdtt file used in your visualization. You can find these values by opening SpaceImaging St Helens.pdtt's () Properties () in the Globe Manager hierarchy. These values are below:

    Terrain Region Value
    South Lat 46.16410701 deg
    West Lon -122.23789314 deg
    North Lat 46.23636045 deg
    East Lon -122.13504296 deg
  4. Click Get Min/Max Alt.
  5. This will display the minimum and maximum altitude values of the region selected in the 2D Graphics window. The minimum and maximum altitudes displayed are estimated based on the selected region for speed reasons. When the region is actually converted, the minimum and maximum values will be updated with the true values.

Reviewing the color options

Review the settings for your color elevation image in the Color Options panel.

  1. Note that HSV is selected for the Color Input Method.
  2. HSV (Hue, saturation, value) is the recommended input method for terrain conversion because it produces a wider range of colors than the RGB (red, green blue) option. RGB is not recommended for terrain conversion because it does not provide as much detail as HSV.

  3. Note that the Altitudes From is set to WGS84.
  4. This specifies that the altitude is referenced from surface of the WGS84 ellipsoid.

  5. Note that Color Ramp is selected for the Input Altitude Colors.
  6. The resulting image will colored so that elevations are drawn with a linearly interpolated color between the minimum altitude and the maximum altitude, depending on the elevation. The default values for Hue, Saturation, and Value will display dark blue at the lowest altitude, green at the mid-point, and white at the highest altitude.

  7. Note that the Use Min/Max Colors at Min/Max Altitudes of Selected Region check box is selected.
  8. This will use the minimum and maximum altitudes within the terrain region as the bounds to linearly interpolate all colors across the color ramp depending on the altitude of a position.

Setting the output file options

Specify the type of file to be created during the conversion.

  1. Open the Format drop-down list in the Output File panel.
  2. Select JPEG 2000 Image (.jp2).
  3. Ensure the Create a pdtt file for the selected region check box is cleared.

You already created a SpaceImaging St Helens.pdtt. You do not need to create another terrain inlay.

Setting the size options

The default size of the image that will be created based on the input data is 1024×1024 pixels. You can increase the output resolution to produce a smoother image for display.

  1. Open the Size drop-down list in the Size Options panel.
  2. Select Custom.
  3. Enter 2048 in the Width field.
  4. Enter 2048 in the Height field.

The default size is recommended when the terrain resolution is to be downsampled.

Specifying the output directory and filename

Select where the output file will be stored.

  1. Click the Directory ellipsis ().
  2. Select your scenario folder (for example, C:\Users\<username>\STK_ODTK 13\Mountain) in the Select Image Directory panel when the Directory dialog box opens.
  3. Click Select Folder to set the directory in which the converted images will be stored and to close the Directory dialog box.
  4. Enter St Helens Topo in the Filename field.

Converting the image

With your configuration set, convert the terrain to create the color elevation image.

  1. Click Convert.
  2. Click Close to close the Create Color Elevation Imagery dialog box.

Viewing the color elevation image in the 3D Graphics window.

Display the topographical inlay in the 3D Graphics window.

  1. Select Earth () in the Globe Manager hierarchy.
  2. Click Add Terrain/Imagery () on the Globe Manager Hierarchy toolbar.
  3. Select Add Terrain/Imagery... (Add Terrain/Imagery button) in the Add Terrain/Imagery drop-down menu.
  4. Open the Path drop-down list when the Globe Manager: Open Terrain and Imagery Data dialog box opens.
  5. Select the check box for St Helens Topo.jp2.
  6. Click Add.
  7. Bring the 3D Graphics window to the front.

3D View: Color shading based on terrain height

Viewing the color elevation image the 2D Graphics window

Inlay your color elevation image in the 2D Graphics window.

  1. Bring the 2D Graphics window to the front.
  2. Click Properties () on the 2D Graphics window's 2D Window Defaults toolbar.
  3. Select the Imagery page when the Properties Browser opens.
  4. Click Add... in the Inlay Images panel.
  5. Select St Helens Topo.jp2 when the Map Images dialog box opens.
  6. Click Open to confirm your selection and to close the Map Images dialog box.
  7. Ensure that the row for SpaceImaging St Helens Topo.jp2 is at the top of the Images table.
  8. The table arranges the images in viewing order. The image that is further up the list displays on top of an image further down in the list.

  9. Verify that the Show check box is selected for SpaceImaging St Helens Topo.jp2 in the Images table.
  10. Click OK to confirm your changes and to close the Properties Browser.

2D View: Color shading based on terrain height

Saving your work

Save your work and close out of your scenario.

  1. When finished, close any utilities and tools still open.
  2. Save () your work.

Summary

This tutorial provided a basic overview of the Imagery and Terrain Converter and the Create Color Elevation Imagery utility. You began by loading an analytical terrain file into your scenario. Using the Imagery and Terrain Converter, you created a terrain inlay file and a JPEG 2000 image for visualization in the STK application. You then used the Create Color Elevation Imagery utility to create an image inlay directly from a terrain file.

On your own

You can also use the Multiple Images converter to batch convert multiple source images, with or without terrain data, into a format that can be visualized in the STK application. You can also use the Terrain Region converter instead of the Single Image Converter to create a terrain inlay file without having to create a .pdttx or .jp2 file. Creating these files separately enables you to convert an updated image for a particular region without having to reconvert the image data.

The STK application also comes with standalone, license-free, command line applications of the utilities used in this tutorial:

  • AgGxChunkImageConverter.exe, the Chunk Image Converter, converts terrain and imagery to .jp2, .pdttx, and .pdtt file formats. The exception is generating JPEG 2000 files for images over 500 MB.
  • AgGxTerrainImageConverter.exe, the Terrain Image Converter, converts terrain to colored image files.

Several other standalone command-line tools are also useful for working with imagery and terrain files:

Lastly, if you want to store your entire globe or share your globe with another user, you can export an STK globe file (*.glb) directly from the Globe Manager by clicking Export Globe () on the Globe Manager Hierarchy toolbar. Globe files are text files that record what files are used in the globe and where they are located in relation to the local system. Imagery and terrain files are not saved as part of the globe file. When sharing globe files, the receiving user must have access to the imagery and terrain files either on their system in the same directory structure as the original user or on the same network resources as the original user.

Further study

To use the Imagery and Terrain Converter utility analytically, see the following tutorial:

Using Terrain, Chains, and Constellations

To use the Create Color Elevation Imagery utility and Imagery and Terrain Converter together to convert a raw satellite image that can be used as an inlay for visualization and situational awareness, see the following tutorial:

Creating Color Elevation Imagery and Using Raw Satellite Imagery