MPTerrainEngine vs RexTerrainEngine

classic Classic list List threaded Threaded
7 messages Options
Xtof Xtof
Reply | Threaded
Open this post in threaded view
|

MPTerrainEngine vs RexTerrainEngine

Hi all,

I’m currently developing a MFC application using osgEarth library (latest master version on GitHub).
The goal of the application is to display an elevation layer (based on a BIL file), an imagery layer (based on OpenStreetMap) and a feature model layer (based on a SHP file) for buildings.

During investigations to find a workaround for my problem on elevation using BIL file on a projected map (not solved yet), I've found differences when displaying elevations from ReadyMap (http://readymap.org/readymap/tiles/1.0.0/9/) with MPTerrainEngine and RexTerrainEngine.
- with MP terrain engine:

- with Rex terrain engine:


Any idea why the elevation doesn't seem to be taken into account with MP terrain engine (the code is exactly the same for two versions except the terrain engine)?

Using osgEarth 2.8.0, the behaviour of MP terrain engine is the same (no elevation) and Rex terrain engine doesn't seem to work.

Thanks,
Christophe
Xtof Xtof
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

Any update for this thread?
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

Hi, there really isn't enough info here for us to help debug your issue.  Both MP and Rex should be taking the elevation into account in the same way.  The MP engine will be deprecated and removed in a future osgEarth release, so I'd recommend sticking with the rex engine if it appears to be working.

It's highly possible that your BIL file doesn't have proper georeferencing information and that is what is causing issues with the elevation.  Can you post a gdalinfo output of the file or post it so we can take a look at it?

Jason

On Tue, Jan 16, 2018 at 10:48 AM Xtof [via osgEarth] <[hidden email]> wrote:
Any update for this thread?


If you reply to this email, your message will be added to the discussion below:
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.
NAML
Xtof Xtof
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

Hi Jason,

All information related to the BIL file are already present in the following thread:
http://forum.osgearth.org/Elevation-using-BIL-file-on-a-projected-map-td7591308.html
And if you need the BIL file, just tell me.

Thanks,
Christophe
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

Yeah, go ahead and stick the BIL file somewhere and we'll look at it.

Can you also provide a snippit of code showing how you are adding the layer to the map?

Jason

On Tue, Jan 16, 2018 at 1:27 PM Xtof [via osgEarth] <[hidden email]> wrote:
Hi Jason,

All information related to the BIL file are already present in the following thread:
http://forum.osgearth.org/Elevation-using-BIL-file-on-a-projected-map-td7591308.html
And if you need the BIL file, just tell me.

Thanks,
Christophe


If you reply to this email, your message will be added to the discussion below:
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.
NAML
Xtof Xtof
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

In fact, you don't need the BIL file, but data from ReadyMap.
The problem appears when displaying an area in projected mode using the MP terrain engine! The same area is displayed correctly when using the Rex terrain engine.

Here is a snippit of the code for a projected area in Boston:
   osg::ref_ptr<osgEarth::SpatialReference> spatialReference = osgEarth::SpatialReference::get("epsg:26919");
   osgEarth::Bounds bounds(291343., 4653876., 367343., 4722276.);

   osgEarth::ProfileOptions profileOptions;
   profileOptions.srsString() = spatialReference->getHorizInitString();
   profileOptions.bounds() = bounds;
   profileOptions.numTilesWideAtLod0() = 1;
   profileOptions.numTilesHighAtLod0() = 1;

   osgEarth::MapOptions mapOptions;
   mapOptions.coordSysType() = osgEarth::MapOptions::CSTYPE_PROJECTED;
   mapOptions.profile() = profileOptions;
   osg::ref_ptr<osgEarth::Map> map = new osgEarth::Map(mapOptions);

#define 1
   // With MP terrain engine, it doesn't work!
   osgEarth::Drivers::MPTerrainEngine::MPTerrainEngineOptions terrainOptions;
#else
   // With Rex terrain engine, it works fine!
   osgEarth::Drivers::RexTerrainEngine::RexTerrainEngineOptions terrainOptions;
#endif
   osgEarth::MapNodeOptions mapNodeOptions(terrainOptions);

   osg::ref_ptr<osgEarth::MapNode> mapNode = new osgEarth::MapNode(map.get(), mapNodeOptions);

   osgEarth::Drivers::TMSOptions driverOptions;
   driverOptions.url() = "http://readymap.org/readymap/tiles/1.0.0/9/";

   osg::ref_ptr<osgEarth::Drivers::ElevationLayer> elevationLayer = new osgEarth::Drivers::ElevationLayer("ReadyMap Terrain", driverOptions);
   mapNode->getMap()->addLayer(elevationLayer.get());

Christophe
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: MPTerrainEngine vs RexTerrainEngine

I'm going to say you have a bad build or some other issue.  I tried with your example using the master osgEarth and things work fine with both Rex and MP.

I've attached the example to this message.

Also note that layer 116 on ReadyMap is the terrain we typically use since it has a bigger tile size than layer 9 and is more efficient to stream.

Jason


On Wed, Jan 17, 2018 at 9:04 AM Xtof [via osgEarth] <[hidden email]> wrote:
In fact, you don't need the BIL file, but data from ReadyMap.
The problem appears when displaying an area in projected mode using the MP terrain engine! The same area is displayed correctly when using the Rex terrain engine.

Here is a snippit of the code for a projected area in Boston:
   osg::ref_ptr<osgEarth::SpatialReference> spatialReference = osgEarth::SpatialReference::get("epsg:26919");
   osgEarth::Bounds bounds(291343., 4653876., 367343., 4722276.);

   osgEarth::ProfileOptions profileOptions;
   profileOptions.srsString() = spatialReference->getHorizInitString();
   profileOptions.bounds() = bounds;
   profileOptions.numTilesWideAtLod0() = 1;
   profileOptions.numTilesHighAtLod0() = 1;

   osgEarth::MapOptions mapOptions;
   mapOptions.coordSysType() = osgEarth::MapOptions::CSTYPE_PROJECTED;
   mapOptions.profile() = profileOptions;
   osg::ref_ptr<osgEarth::Map> map = new osgEarth::Map(mapOptions);

#define 1
   // With MP terrain engine, it doesn't work!
   osgEarth::Drivers::MPTerrainEngine::MPTerrainEngineOptions terrainOptions;
#else
   // With Rex terrain engine, it works fine!
   osgEarth::Drivers::RexTerrainEngine::RexTerrainEngineOptions terrainOptions;
#endif
   osgEarth::MapNodeOptions mapNodeOptions(terrainOptions);

   osg::ref_ptr<osgEarth::MapNode> mapNode = new osgEarth::MapNode(map.get(), mapNodeOptions);

   osgEarth::Drivers::TMSOptions driverOptions;
   driverOptions.url() = "http://readymap.org/readymap/tiles/1.0.0/9/";

   osg::ref_ptr<osgEarth::Drivers::ElevationLayer> elevationLayer = new osgEarth::Drivers::ElevationLayer("ReadyMap Terrain", driverOptions);
   mapNode->getMap()->addLayer(elevationLayer.get());

Christophe


If you reply to this email, your message will be added to the discussion below:
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.
NAML

osgearth_engine_test.cpp (5K) Download Attachment