adrianj Newbie
Joined: 19 Jan 2018 Posts: 14
|
Posted: Tue Feb 06, 2018 3:19 am Post subject: How to set the transparency for one of my terrain layers? |
|
|
Hello,
I am using osgEarth to overlay a survey map onto another map. The survey image is generated as a GeoTiff and draped across the base map. I would like the areas that have no data (white) to be transparent. How do I do this? So far my code is like this but it does nothing at all.
Code:
|
GDALOptions gdalOptImg;
gdalOptImg.url() = url;
gdalOptImg.noDataValue() = 0;
ImageLayerOptions layerOptions(name, gdalOptImg);
osg::Vec4ub *transparentColor = new osg::Vec4ub();
transparentColor->r() = 255.0f;
transparentColor->g() = 255.0f;
transparentColor->b() = 255.0f;
transparentColor->a() = 1.0;
layerOptions.transparentColor() = *transparentColor;
layerOptions.name() = name;
imageryLayer = new ImageLayer(layerOptions);
|
I have tried a trillion different combinations but none of them seem to do anything.
If you reply please provide a code example, or links to where I can read more information about this, not just an API. Some source code is worth a thousand words
Many thanks for your help!
[/code] |
|