WorldWind Java’s 3D terrain system is built from three interlocking pieces: theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nasaworldwind/worldwindjava/llms.txt
Use this file to discover all available pages before exploring further.
Globe, which defines the planet’s shape and provides elevation data; the Tessellator, which subdivides the visible surface into a variable-resolution triangle mesh each frame; and the ElevationModel, which supplies the actual elevation samples that give the mesh its topographic shape. Together they produce the smooth, multi-resolution terrain that adapts in real time as the camera moves. For analysis tasks that require precise terrain queries — line-of-sight, terrain profiles, surface drape — the HighResolutionTerrain class provides a separate, always-maximum-resolution path independent of the rendering tessellator.
The Globe Interface
Globe (gov.nasa.worldwind.globes.Globe) is the foundation of the terrain system. It owns the ElevationModel and the Tessellator, and it provides coordinate-conversion methods used throughout the rendering pipeline.
Globe interface — key method signatures
worldwind.xml is Earth (gov.nasa.worldwind.globes.Earth), which extends EllipsoidalGlobe using WGS84 parameters. WorldWind also ships FlatGlobe for 2D flat-map projections; because the Globe is swappable at runtime, the same application can toggle between 3D globe and 2D flat-map views by replacing model.setGlobe(...).
Elevation Models
TheElevationModel interface (gov.nasa.worldwind.globes.ElevationModel) supplies elevation samples to the tessellator and to direct queries. Models often approximate elevations at multiple resolutions; the model returns the best available data for the current view.
ElevationModel interface — key method signatures
ElevationModel Implementations
| Class | Description |
|---|---|
BasicElevationModel | Loads elevation tiles from a WMS server or local tile pyramid. Configured via XML (see config/Earth/EarthElevations2.xml). |
CompoundElevationModel | Stacks multiple ElevationModel instances. The model with the finest resolution takes precedence for any given location. |
LocalElevationModel | Reads elevation rasters directly from local files (GeoTIFF, BIL, etc.). Suitable for offline or custom datasets. |
ZeroElevationModel | Always returns zero elevation. Used with FlatGlobe for 2D projections where terrain relief is not needed. |
WMSBasicElevationModel | A BasicElevationModel specialization for OGC WMS 1.1 and 1.3 elevation sources. |
WCSElevationModel | Retrieves elevation data from an OGC Web Coverage Service (WCS). |
CompoundElevationModel
CompoundElevationModel (gov.nasa.worldwind.terrain.CompoundElevationModel) is the standard way to layer elevation sources. The list is automatically sorted from lowest to highest resolution; higher-resolution models override lower-resolution ones for locations they cover.
CompoundElevationModel — stacking two elevation sources
Tessellation
TheTessellator (gov.nasa.worldwind.terrain.Tessellator) converts the globe’s smooth mathematical surface into a renderable triangle mesh each frame. WorldWind’s default implementation is RectangularTessellator (gov.nasa.worldwind.terrain.RectangularTessellator).
Each frame, RectangularTessellator:
- Determines which parts of the globe are visible in the current view frustum.
- Subdivides the visible surface into a grid of
SectorGeometrytiles. Tiles that are close to the eye or that subtend a large screen area are subdivided to finer levels of detail; distant tiles use coarser geometry. - Queries the
ElevationModelfor each tile’s sector and applies the elevation samples as vertex displacements, giving the mesh its topographic shape. - Returns a
SectorGeometryListthat layer renderers use to drape imagery and shapes onto the terrain.
gov.nasa.worldwind.avkey.RectangularTessellatorMaxLevel configuration property (default 30 levels). Vertical exaggeration can be applied through SceneController.setVerticalExaggeration(double).
High-Resolution Terrain
HighResolutionTerrain (gov.nasa.worldwind.terrain.HighResolutionTerrain) provides accurate terrain computations that are independent of the rendering tessellator. While the rendering tessellator dynamically adjusts resolution based on what is visible, HighResolutionTerrain always uses the maximum available resolution from the elevation model — blocking if necessary to retrieve data from disk or network.
Use HighResolutionTerrain when you need:
- Line-of-sight calculations between two positions
- Terrain profiles along a path
- Surface drape — computing exact surface points for positions that must lie on the terrain
- Any geometric operation where rendering-quality accuracy is insufficient
HighResolutionTerrain — constructors
HighResolutionTerrain — line-of-sight intersection
HighResolutionTerrain.intersect() blocks the calling thread while it loads elevation tiles. Always call it from a background thread (e.g. WorldWind.getTaskService().addTask(...)) and never from the Event Dispatch Thread or the OpenGL render thread, or the application will freeze until all required tiles are loaded.Getting the Elevation at a Point
Querying elevation at a latitude/longitude
Coordinate Systems
WorldWind uses two coordinate systems throughout its API:Geodetic Coordinates (LatLon, Position)
Geographic positions expressed as latitude, longitude, and optionally an altitude in meters above the WGS84 ellipsoid. LatLon stores a 2D geographic location; Position extends LatLon with an elevation field.
LatLon and Position
Cartesian Coordinates (Vec4)
Three-dimensional vectors (gov.nasa.worldwind.geom.Vec4) in the globe’s Cartesian space. For EllipsoidalGlobe (including Earth), the origin is at the center of the Earth, +Z points toward the North Pole, and +X points toward the intersection of the prime meridian and equator.
Converting between geodetic and Cartesian
The rendering tessellator adjusts terrain mesh resolution dynamically based on the camera position — tiles close to the eye are subdivided more finely, distant tiles less so. This means the rendered terrain you see on screen may be at a lower resolution than the elevation data actually available for that area.
HighResolutionTerrain, by contrast, always uses the best available resolution for every computation, regardless of where the camera is pointing. Use the rendering tessellator for real-time display and HighResolutionTerrain for offline analysis tasks where accuracy matters more than frame rate.