glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
116 stars 56 forks source link

load online terrain #214

Closed venci01 closed 7 years ago

venci01 commented 7 years ago

hi,@DiegoGomezDeck i am studying glob3mobile,but i don not know how to load online terrain

http://worldwind26.arc.nasa.gov/wms

<?xml version="1.0" encoding="UTF-8"?>

USA 10m, World 30m, Ocean 900m http://worldwind26.arc.nasa.gov/wms http://worldwind26.arc.nasa.gov/wms NASA_SRTM30_900m_Tiled,aster_v2,USGS-NED true 16 01 2014 20:00:00 GMT Earth/EarthElevations2 application/bil16 0.30 .bil config/SRTM30Plus_ExtremeElevations_5.bil
mdelacalle commented 7 years ago

The terrain feature is under severe refactoring those days, but you can use easily the class ElevationDataProvider. You have an Android example here (on the iOS demo you'll have the same example): https://github.com/glob3mobile/g3m/blob/purgatory/Android/G3MAndroidDemo/src/org/glob3/mobile/demo/ScenarioTerrainActivity.java

You only have to:

   final float verticalExaggeration = 2f;
  final double deltaHeight = -700.905;   // this delta is used for the camera, if your terrain is close to the sea or is the whole world 0 is a good number.

// This is the sector where you have terrain final Geodetic2D lower = new Geodetic2D( // Angle.fromDegrees(40.1665739916489), // Angle.fromDegrees(-5.85449532145337)); final Geodetic2D upper = new Geodetic2D( // Angle.fromDegrees(40.3320215899527), // Angle.fromDegrees(-5.5116079822178570));

  final Sector demSector = new Sector(lower, upper);

  // NROWS          1335
  // NCOLS          2516
  // You have to put the bil file under assets folder and you have to put the number of rows and      //columns  for your dataset
  final ElevationDataProvider elevationDataProvider = new SingleBilElevationDataProvider(new URL("file:///0576.bil", false),
           demSector, new Vector2I(2516, 1335), deltaHeight);

  builder.getPlanetRendererBuilder().setElevationDataProvider(elevationDataProvider);
  builder.getPlanetRendererBuilder().setVerticalExaggeration(verticalExaggeration);

Thanks for using it.

Best regards