Can't display tif image layer in program

classic Classic list List threaded Threaded
2 messages Options
Paul Paul
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Can't display tif image layer in program

HI, I'm just starting out with osgearth and I have this .earth file:

<map type="geocentric" version="2">
   
    <options>
        <terrain vertical_scale="3"/>
    </options>

        <image name="world" driver="gdal">
        <url>earth.tif</url>
        </image>

      <heightfield name="terrain" driver="gdal">

          <url>eaarthheight.tif</url>
       
       
          <extensions>tif</extensions> 

    </heightfield>
   
   
   <options>
        <cache driver="filesystem">
          <path>./cache</path>
         </cache> 
   </options>
   
</map>


It displays no problem. But I don't know how to do the same programmatically without using a .earth file.
When I try using the examples in the docs I don't get the imagery displayed. I used:

        TMSOptions tms;
        tms.url() = "earth.tif";
        ImageLayer* layer = new ImageLayer( "TIF", tms );
        map->addLayer( layer );

Is there a special .tif driver I need to specify?

Also how do I setup a simple sky in the same program?

 Best regards,
examyes examyes
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't display tif image layer in program

Please use GDALOptions.

#include <osgEarthDrivers/gdal/GDALOptions>
Loading...