The osgEarth Utils namespace includes a variety of useful classes for interacting
with the map. None of these are strictly necessary for using osgEarth, but they do
make it easier to perform some common operations.

The DataScanner will recursively search a directory tree on the local filesystem
for files that it can load as ImageLayer objects. It is a quick and easy way to
load a full directory of images as layers.

NOTE that only the MP Terrain Engine supports an unlimited number of image layers,
so it is wise to use that engine in conjunction with the DataScanner.

DetailTexture is a terrain controller that will apply a non-geospatial texture
across the terrain. This is an old trick that you can use to generate “noise” that makes
a low resolution terrain appear more detailed:

In whole-earth applications it’s common that you want to see something up close (like
an aircraft at altitude) while seeing the Earth and its horizon off in the distance.
This poses a problem for modern graphic hardware because the standard depth buffer
precision heavily favors objects closer to the camera, and viewing such a wide range
of objects leads to “z-fighting” artifacts.

The LogarithmicDepthBuffer is one way to solve this problem. It uses a shader to
re-map the GPU’s depth buffer values so they can be put to better use in this type
of scenario.

It’s easy to install:

LogarithmicDepthBufferlogdepth;logdepth->install(view->getCamera());

Or you can activate it from osgearth_viewer or other examples:

osgearth_viewer--logdepth...

Since it does alter the projection-space coordinates of your geometry at draw time,
you do need to be careful that you aren’t doing anything ELSE in clip space in your
own custom shaders that would conflict with this.

(10-Jul-2014: Some osgEarth features are incompatible with the log depth buffer;
namely, GPU clamping and Shadowing. Depth Offset works correctly though.)

The MGRSFormatter constructs a string according to the Military Grid Reference System.
Technically, an MGRS coordinate represents a region rather than an exact point, so you
have to specify a precision qualifier to control the size of the represented region.
Example:

The MouseCoordsTool reports the map coordinates under the mouse (or other pointing device).
Install a callback to respond to the reports. MouseCoordsTool is an osgGA::GUIEventHandler
that you can install on a Viewer or any Node, like so:

For your convenience, MouseCoordsTool also comes with a stock callback that will
print the coords to osgEarthUtil::Controls::LabelControl. You can even pass a
LabelControl to the constructor to make it even easier.