Search code examples
javaandroidworldwind

WorldWind: elevation of the ground


I use WorldWind to display in an android application a globe. I managed to display the satellite image.

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.FrameLayout;

import gov.nasa.worldwind.WorldWindow;
import gov.nasa.worldwind.layer.BackgroundLayer;    
import gov.nasa.worldwind.layer.BlueMarbleLandsatLayer;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Create a WorldWindow (a GLSurfaceView)...
        WorldWindow wwd = new WorldWindow(getApplicationContext());
        // ... and add some map layers
        wwd.getLayers().addLayer(new BackgroundLayer());
        wwd.getLayers().addLayer(new BlueMarbleLandsatLayer());            

        // Add the WorldWindow view object to the layout that was reserved for the globe.
        FrameLayout globeLayout = (FrameLayout) findViewById(R.id.globe);
        globeLayout.addView(wwd);
    }

}

From the example of the WorldWind web site I would like to add the elevation (relief) of the terrain on the globe (to see mountains, volcanoes ...). How can I do ?

Thank you


Solution

  • I found the answer, you must add this line

    wwd.getGlobe().getElevationModel().addCoverage(new BasicElevationCoverage());