GeoTiff ImageLayers Loading-Times and Memory Usage

classic Classic list List threaded Threaded
2 messages Options
ceranco ceranco
Reply | Threaded
Open this post in threaded view

GeoTiff ImageLayers Loading-Times and Memory Usage

Hi everyone,

I've noticed a sharp increase in loading times and memory usage when loading GeoTiff image layers after updating my application from osgEarth 2.9 / OpenSceneGraph 3.6 to osgEarth 2.10 / OpenSceneGraph 3.6.3.

I've also moved from using OpenSceneGraph's pre-built dependencies to building them myself, so I think the problem may lay there.

The optional dependencies I use for OSG are:
* Zlib
* Jpeg
* cURL
* png
* FreeType
* Collada-Dom
* GDAL (with OpenJpeg)

I link against the same GDAL and cURL dependencies in osgEarth.

Does anyone see anything missing, or know which dependency should be specially configured that affects the performance of ImageLayers?

Eran Cohen
Eran Cohen
ceranco ceranco
Reply | Threaded
Open this post in threaded view

Re: GeoTiff ImageLayers Loading-Times and Memory Usage

I checked and it seems the problem lies in a change between osgEarth 2.9 and osgEarth 2.10:
I compiled the two different osgEarth versions against the same osg binaries and ran the same test program:

class Handler : public osgGA::GuiEventHandler
  osgEarth::Map* const map;

  Handler(osgEarth::Map* map) : map(map) {}

  virtual bool handle(const osgGA::GUIEventAdapter& ea, const osgGA::GUIActionAdapter& aa)
    auto createImageLayer = [](const std::string& path) {
      GDALOptions options;
      options.url() = path;

      return new osgEarth::ImageLayer{ options };

    auto baseLayer = createImageLayer("data/world8.tif");
    auto insetLayer = createImageLayer("data/inset/");


    return true;
  return false;

int main(int argc, char** argv)
  RexTerrainEngineOptions terrainOpt; = true;

  auto map = new osgEarth::Map;
  MapNodeOptions mapNodeOpt{ terrainOpt };
  auto mapNode = new osgEarth::MapNode{ map, mapNodeOpt };

  auto root = new osg::Group;

  viewer.setCameraManipulator(new EarthManipulator);
  viewer.addEventHandler(new Handler{ map });


The program simply waits until I press the return(enter) key, then adds two image layers to the map.
The "data/inset/" folder contains two GeoTiffs, each one about 160mb.

When using osgEarth 2.9, the layers load very quickly and the memory used while zoomed out is about 90mb, and when zoomed in about 450 mb.
The image quickly comes into focus.

When using osgEarth 2.10, the layers load slowly, the memory used while zoomed out is about 430mb versus 450 when zoomed in, and the images remain blurry for a long time (a couple of seconds).

Does anyone know what might have affected loading ImageLayers (or maybe GeoTiffs...)?
Eran Cohen