Incorporating Multiple Images Into Single Layer

classic Classic list List threaded Threaded
3 messages Options
Ryan Kawicki Ryan Kawicki
Reply | Threaded
Open this post in threaded view
|

Incorporating Multiple Images Into Single Layer

Configuration:
osg : 3.5.10
osgEarth : 2.9.0
compiler : Visual Studio 2015 x64

This is more of a nice to have, but I am currently in development of a feature to incorporate multiple raster images into a single layer.  The kicker here is that they do not all belong to the same directory; otherwise, I could use the directory URI property from the GDAL driver.  I also do not have the ability to modify the directory structure of the source data either, as that has been considered too.

I was thinking that I could just incorporate all the images into their own layers, but that feels wrong and seems that it could lead to performance issues.  Also, in a little test to evaluate this capability, it produces a very unpleasing visual, as the warped (I forget to mention this is a projected terrain) images produce a black outline that is very clearly seen.

*** EXAMPLE ***
   <image name="image1" driver="gdal">
      <url>D:/image1_location/image1.tif</url>
      <feather_pixels>false</feather_pixels>
      <texture_compression>auto</texture_compression>
   </image>
   <image name="image2" driver="gdal">
      <url>D:/image2_location/image2.tif</url>
      <feather_pixels>false</feather_pixels>
      <texture_compression>auto</texture_compression>
   </image>
   <image name="image3" driver="gdal">
      <url>D:/image3_location/image3.tif</url>
      <feather_pixels>false</feather_pixels>
   </image>
   . . .

Multiple Image Layers

Hopefully, it can be seen that having the multiple image layers produces a very unpleasing outline for each image.  Using the directory capability, the inner lines are not visible.
*** END EXAMPLE ***

What I am after is a new capability that will allow me to specify multiple image paths within the earth configuration file.

I was hoping that I could have done the following, but the GDALOptions will only pull out the first URL that it comes to when getting the information.

*** EXAMPLE ***
   <image name="multiple images" driver="gdal">
      <url>D:/image1_location/image1.tif</url>
      <url>D:/image2_location/image2.tif</url>
      <url>D:/image3_location/image3.tif</url>
   </image>

GDALOptions
   conf.getIfSet( "url", _url );
*** END EXAMPLE ***

The above appears that it could be technically possible, but it would require changes to the optional<URI> within the GDALOptions and modification of the ReaderWriterGDAL.cpp, to accept a different mechanism for multiple URLs.

So, with that long winded explanation, has there been a need to have this type of capability for the GDAL driver model?  Is there any reason why this mechanism could not be used?  Can you think of any invalid use cases that should be considered or assertions that should be made (i.e. only can be used with the local filesystem)?  Is there any plans on the 3.0 branch to have this capability (I did not notice any changes there)?

Thanks,
Ryan
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Incorporating Multiple Images Into Single Layer

Ryan,

The preferred way is the make a GDAL VRT (using the gdalbuildvrt tool) offline and then loading that .vrt with the GDAL driver.

Another way is to wrap your set of image layers in a composite layer like so:

<image driver="composite">
   <image ..
   <image ..
</image>

VRT will give you the best results and will also be faster. Hope this helps.
Glenn Waldron / Pelican Mapping
Ryan Kawicki Ryan Kawicki
Reply | Threaded
Open this post in threaded view
|

Re: Incorporating Multiple Images Into Single Layer

Thank you for the reply and the information.

I was unaware of the composite driver capability and did not even look at GDALs VRT option.  I will look at these two options as a path forward for resolving my situation.

Ryan