Fixing World Wind Extruded Polygons on Ground Errors

Written by

in

Guide to World Wind Extruded Polygons on Ground NASA World Wind is a powerful open-source virtual globe SDK that allows developers to visualize geographic data in 3D. Among its various shape types, extruded polygons on the ground are essential for representing 3D spatial boundaries, such as building footprints, urban planning zones, and flight corridors.

This guide explains how to implement and optimize extruded polygons on the ground in World Wind. Understanding Extruded Polygons

An extruded polygon transforms a flat 2D shape on the Earth’s surface into a 3D volume. It achieves this by extending the boundaries upward or downward to a specified altitude. Base: The footprint rests directly on the terrain (ground).

Walls: Vertical polygons connect the base boundary to the cap. Cap: The flat top surface situated at the maximum altitude. Key Properties and Implementation

To create an extruded polygon in World Wind, you define its geographic coordinates and configure its visual and structural attributes. 1. Defining Geometry

You must provide a list of geographic positions (latitude and longitude) that form a closed loop. The framework uses these coordinates to anchor the base of the shape to the digital elevation model (DEM). 2. Setting Altitude and Extrusion

Altitude Mode: Set the altitude mode to WorldWind.RELATIVE_TO_GROUND or WorldWind.ABSOLUTE. For shapes resting on the terrain, relative mode ensures the polygon adapts to hills and valleys.

Height: Specify the extrusion height in meters. This dictates how far the walls extend upward from the ground. 3. Applying Attributes

You can style extruded polygons using shape attributes to distinguish different data layers. Interior Color: Fills the cap and the vertical walls. Outline Color: Highlights the edges of the 3D volume.

Transparency: Crucial for urban planning, allowing users to see through structures to view underlying terrain or infrastructure. Step-by-Step Code Example

Below is a standard JavaScript implementation using the World Wind Web SDK to create an extruded polygon on the ground. javascript

// 1. Initialize the polygon geometry (coordinates) var boundaries = [ new WorldWind.Position(37.7749, -122.4194, 0), // San Francisco example new WorldWind.Position(37.7752, -122.4178, 0), new WorldWind.Position(37.7735, -122.4168, 0), new WorldWind.Position(37.7732, -122.4185, 0) ]; // 2. Create the ExtrudedPolygon object var extrudedPolygon = new WorldWind.ExtrudedPolygon(boundaries, null); // 3. Configure height and ground anchoring extrudedPolygon.extruded = true; extrudedPolygon.height = 150; // Height in meters extrudedPolygon.altitudeMode = WorldWind.RELATIVE_TO_GROUND; // 4. Define visual attributes var attributes = new WorldWind.ShapeAttributes(null); attributes.interiorColor = new WorldWind.Color(0, 0.5, 1, 0.6); // Semi-transparent blue attributes.outlineColor = new WorldWind.Color(0, 0.2, 0.8, 1.0); // Solid blue outline attributes.drawOutline = true; attributes.drawInterior = true; extrudedPolygon.attributes = attributes; // 5. Add to a renderable layer var polygonLayer = new WorldWind.RenderableLayer(“Extruded Polygons”); polygonLayer.addRenderable(extrudedPolygon); wwd.addLayer(polygonLayer); Use code with caution. Performance Optimization Tips

Rendering multiple 3D structures simultaneously can strain system resources. Use these strategies to maintain smooth performance:

Enable Level of Detail (LOD): Reduce the geometric complexity of polygons when the camera views them from a high altitude.

Batch Rendering: Group static polygons into a single renderable layer to minimize WebGL draw calls.

Simplify Complex Paths: Reduce the number of vertices in your source polygons before passing them to World Wind. Avoid complex curves with hundreds of coordinate points. If you want to tailor this implementation, tell me: Which SDK version are you using? (Web, Android, or Java?)

What type of data are you visualizing? (Buildings, airspace, zones?) Do you need to handle hole cutouts inside your polygons?

I can provide the exact code block or data-parsing logic you need.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *