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.
- Launch the STK application (
). - Click in the Welcome to STK dialog box.
- Enter the following in the STK: New Scenario Wizard:
- Click when you finish.
- Click Save (
) when the scenario loads. - Verify the scenario name and location in the Save As dialog box.
- Click .
| Option | Value |
|---|---|
| Name | Mountain |
| Location | Default |
| Start | Use the default date / set the time to 19:00.00.000 UTCG |
| Stop | + 24 hr |
The STK software creates a folder with the same name as your scenario for you.
Save (
) often during this lesson!
Importing terrain data into a scenario
You can use the Scenario object's
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.
- Right-click on Mountain (
) in the Object Browser. - Select Properties (
) in the shortcut menu. - Select the Basic - Terrain page when the Properties Browser opens.
- Clear the Use terrain server for analysis check box in the Terrain Server panel.
- Click to confirm your change and to keep the Properties Browser open.
Using a custom analysis terrain source
Use a preinstalled, medium-resolution,
- Click in the Custom Analysis Terrain Sources panel.
- Open the file type drop-down list when the Open dialog box opens.
- Select USGS DEM (DEM) (*.dem).
- Browse to the preinstealled hoquiam-e.dem in <Install Dir>\Data\Resources\stktraining\samples.
- Select hoquiam-e.dem.
- Click to select the file and to close the Open dialog box.
- Click to confirm your selection and to close the Properties Browser.
- 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
| Image Formats | Description |
|---|---|
|
|
AGI proprietary image format for 3D and 2D Graphics windows |
|
|
Non-proprietary image format for 3D and 2D Graphics windows |
| Terrain Formats | Description |
|---|---|
|
|
AGI proprietary terrain inlay for 3D Graphics windows |
You can
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
- Select the Utilities menu in the Menu Bar.
- Select Imagery and Terrain Converter... in the Utilities menu.
Opening the Single Image Converter
The
- Select the Single Image page when the Imagery and Terrain Converter opens.
- Click the Image Filename ellipsis (
) in the Input Data panel. - Browse to <Install Dir>\Data\Resources\stktraining\samples when the File dialog box opens.
- Select SpaceImaging St Helens.sid.
- Click to confirm your selection and to close the Open dialog box.
SpaceImaging St Helens.sid is a multiresolution seamless image database (MrSID) file, and is courtesy of Space Imaging, Inc.
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.
- Select the Use check box in the Terrain panel.
- Open the Use drop-down list.
- 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.
- Ensure JPEG 2000 Image (jp2) is selected for the Format in the Image File panel.
- Select the Compression Ratio option in the JPEG 2000 Compression panel.
- Enter 10 in the x:1 field.
- Click the Directory ellipsis (
) in the Image File panel. - Select the STK User folder in the left navigation pane when the Directory dialog box opens.
- Select your scenario folder (for example, Mountain) in the folder and file list.
- Click to set the directory in which the converted images will be stored and to close the Directory dialog box.
- Ensure the Use Output Image Data check box is selected in the Terrain File panel.
- Ensure the Delete Intermediate Terrain File check box is selected.
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.
This is ratio of the compressed file to the uncompressed file.
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).
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.
- Click .
- Click to close the Imagery and Terrain Converter.
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.
Displaying the imagery and terrain in the 3D Graphics window
You can add your converted imagery and terrain to a globe with the
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
- Bring the 3D Graphics window to the front.
- Click Globe Manager (
) on the 3D Graphics window's Globe Manager toolbar. - Click Add Terrain/Imagery (
) on the Globe Manager Hierarchy toolbar when the Globe Manager window opens. - Select Add Terrain/Imagery... (
) in the Add Terrain/Imagery drop-down menu. - Open the Path drop-down list when the Globe Manager: Open Terrain and Imagery Data dialog box opens.
- Select your scenario folder (for example, C:\Users\<username>\STK_ODTK 13\Mountain).
- Select the check boxes for both SpaceImaging St Helens.jp2 and SpaceImaging St Helens.pdtt.
- Click .
- Click . when the Use Terrain for Analysis dialog box opens.
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.
- Select SpaceImaging St Helens.jp2 (
) in the Globe Manager hierarchy. - Click Zoom To (
) on the Globe Manager Hierarchy toolbar. - Move around in the 3D Graphics window to get a good view of the terrain and imagery.
This will take you directly to the image in the 3D Graphics window.
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.
- Select SpaceImaging St Helens.jp2 (
) in the Globe Manager hierarchy. - Click Toggle Extents (
) on the Globe Manager Hierarchy toolbar. - Note that an extent indicator (
) is displayed next to SpaceImaging St Helens.jp2 (
) in the Globe Manager hierarchy. - Click Toggle Extents (
) again to turn off the highlighting.
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.
Displaying the image inlay in the 2D Graphics window
Update the 2D Graphics window's
- Bring the 2D Graphics window to the front.
- Click Properties (
) on the 2D Graphics window's 2D Window Defaults toolbar. - Select the Imagery page when the Properties Browser opens.
- Click in the Inlay Images panel.
- Browse to your scenario folder when the Map Images dialog box opens, if it does not open in that location automatically.
- Select SpaceImaging St Helens.jp2.
- Click to confirm your selection and to close the Map Images dialog box.
- Verify that the Show check box is selected in the Images table.
- Select the Show Image Extents check box in the Image Display Options panel.
- Click to confirm your changes and to keep the Properties Browser open.
When selected, this displays a boundary around each imported image in the 2D Graphics window.
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.
- Select the SpaceImaging St Helens.jp2 row in the Images table.
- Click Zoom To (
). - Click to close the Properties Browser.
- Bring the 2D Graphics window to the front.
- 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.
2D View: Mount St. Helens WITH image extent SHOWN
Using the Create Color Elevation Imagery utility
The
Create Color Elevation utility workflow
Opening the Create Color Elevation Imagery utility
- Select the Utilities menu on the Menu Bar.
- 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.
- Ensure the Select On 2D Map check box is selected in the Terrain Region panel when the Create Color Elevation Imagery dialog box opens.
- 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.
- Click .
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 |
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.
- Note that HSV is selected for the Color Input Method.
- Note that the Altitudes From is set to WGS84.
- Note that Color Ramp is selected for the Input Altitude Colors.
- Note that the Use Min/Max Colors at Min/Max Altitudes of Selected Region check box is selected.
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.
This specifies that the altitude is referenced from surface of the WGS84 ellipsoid.
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.
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.
- Open the Format drop-down list in the Output File panel.
- Select JPEG 2000 Image (.jp2).
- 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.
- Open the Size drop-down list in the Size Options panel.
- Select Custom.
- Enter 2048 in the Width field.
- 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.
- Click the Directory ellipsis (
). - 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.
- Click to set the directory in which the converted images will be stored and to close the Directory dialog box.
- Enter St Helens Topo in the Filename field.
Converting the image
With your configuration set, convert the terrain to create the color elevation image.
- Click .
- Click 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.
- Select Earth (
) in the Globe Manager hierarchy. - Click Add Terrain/Imagery (
) on the Globe Manager Hierarchy toolbar. - Select Add Terrain/Imagery... (
) in the Add Terrain/Imagery drop-down menu. - Open the Path drop-down list when the Globe Manager: Open Terrain and Imagery Data dialog box opens.
- Select the check box for St Helens Topo.jp2.
- Click .
- 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.
- Bring the 2D Graphics window to the front.
- Click Properties (
) on the 2D Graphics window's 2D Window Defaults toolbar. - Select the Imagery page when the Properties Browser opens.
- Click in the Inlay Images panel.
- Select St Helens Topo.jp2 when the Map Images dialog box opens.
- Click to confirm your selection and to close the Map Images dialog box.
- Ensure that the row for SpaceImaging St Helens Topo.jp2 is at the top of the Images table.
- Verify that the Show check box is selected for SpaceImaging St Helens Topo.jp2 in the Images table.
- Click to confirm your changes and to close the Properties Browser.
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.
2D View: Color shading based on terrain height
Saving your work
Save your work and close out of your scenario.
- When finished, close any utilities and tools still open.
- 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:
- AgImageConverter.exe converts TIF, TGA, PNG, PPM, BMP, CIB, and CADRG images to PPM or BMP file formats.
- AgImageAlign.exe aligns images.
- AgImageComposer.exe combines multiple images.
- AgGx3dTerrainTextureCreate.exe converts images from many standard formats to PDTTX image files.
- AgAsDtedConvert.exe converts terrain data. It uses a source file containing raw terrain data to create a processed terrain file (.datt format). The *.datt format is compatible with conversion tools that create PDTT terrain files.
- AgGx3dTerrainCreate.exe converts processed terrain files (.datt format) to PDTT 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