2004-08-10 21:19:04 +08:00
|
|
|
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type"
|
|
|
|
content="text/html; charset=iso-8859-1">
|
|
|
|
<meta name="GENERATOR"
|
|
|
|
content="Mozilla/4.77 [en] (X11; U; Linux 2.4.3-20mdk i686) [Netscape]">
|
|
|
|
<title>examples</title>
|
|
|
|
</head>
|
|
|
|
<body text="#000000" bgcolor="#ffffff" link="#0000ff" vlink="#990066"
|
|
|
|
alink="#ff0000">
|
|
|
|
<img src="images/OpenSceneGraphBanner_Distribution.jpg">
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td><a href="index.html">Index</a></td>
|
|
|
|
<td><a href="introduction.html">Introduction</a></td>
|
|
|
|
<td><a href="contents.html">Contents</a></td>
|
|
|
|
<td><a href="install.html">Install</a></td>
|
|
|
|
<td><a href="dependencies.html">Dependencies</a></td>
|
|
|
|
<td><a href="examples.html">examples</a></td>
|
|
|
|
<td><a href="data.html">Data</a></td>
|
|
|
|
<td><a href="osgviewer.html">Viewer</a></td>
|
|
|
|
<td><a href="stereo.html">Stereo</a></td>
|
|
|
|
<td><a href="osgdem.html">osgdem</a></td>
|
|
|
|
<td><a href="plan.html">Plan</a></td>
|
|
|
|
<td><a href="documentation.html">Reference Guides</a></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<h2>
|
|
|
|
<a name="Using_osgdem"></a><u>Using osgdem to generate geospatial
|
|
|
|
terrain databases</u></h2>
|
|
|
|
<ol>
|
|
|
|
<li><a href="#Quick_step_by_step_guide:">Quick step by step guide</a></li>
|
|
|
|
<li><a href="#osgdem_options">osgdem options</a></li>
|
|
|
|
</ol>
|
|
|
|
<hr style="width: 100%; height: 2px;">
|
|
|
|
<h3><a name="Quick_step_by_step_guide:"></a>Quick step by step guide:</h3>
|
2004-08-14 23:42:01 +08:00
|
|
|
What follows are the steps required to get osgTerrain/osgdem compiling and
|
|
|
|
an example of how to use it to process imagery and DEM's to generate a
|
2004-08-10 21:19:04 +08:00
|
|
|
paged databases.<br>
|
|
|
|
<br>
|
|
|
|
1) Download, compile & install GDAL. <br>
|
|
|
|
<br>
|
|
|
|
2) Get the latest OSG in CVS.<br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
3) For UNIX 'make' users, make a copy of Make/dependencies and change the
|
2004-08-10 21:19:04 +08:00
|
|
|
GDAL_INSTALL entry to:<br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><span style="font-weight: bold;">set
|
|
|
|
GDAL_INSTALL = true </span><br>
|
|
|
|
<span style="font-weight: bold;"></span></div>
|
|
|
|
<span style="font-weight: bold;"><br>
|
2004-08-14 23:42:01 +08:00
|
|
|
</span>Then tell the build to use your custom
|
2004-08-10 21:19:04 +08:00
|
|
|
dependencies by setting the environmental variable OSG_DEPENDENCIES to
|
|
|
|
the absolute path to your file i.e.:<br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><span style="font-weight: bold;">export
|
|
|
|
OSG_DEPENDENCIES=/home/billgates/my_osg_dependencies</span><br>
|
|
|
|
</div>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
4) Rebuild the OSG & install (if you haven't already).<br>
|
2004-08-10 21:19:04 +08:00
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
5) Oh, make sure you have a couple of GB of spare disk space, because
|
|
|
|
you're going to need it :-) <br>
|
2004-08-10 21:19:04 +08:00
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
6) Download some data, for this example I'm using the Puget Sound data
|
2004-08-10 21:19:04 +08:00
|
|
|
at: <br>
|
|
|
|
<br>
|
|
|
|
<a
|
|
|
|
href="http://www.cc.gatech.edu/projects/large_models/ps.html">http://www.cc.gatech.edu/projects/large_models/ps.html
|
|
|
|
</a><br>
|
|
|
|
<br>
|
|
|
|
Download Elevation Map:
|
|
|
|
16385 × 16385 PNG: 188MB <br>
|
|
|
|
Download Texture Map:
|
|
|
|
16384 × 16384 PNG: 268MB <br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
7) To avoid aliasing artifacts when accessing data I use <a
|
2004-08-10 21:19:04 +08:00
|
|
|
href="http://www.remotesensing.org/gdal/gdal_utilities.html">GDAL
|
|
|
|
utilitiy
|
|
|
|
programs</a> to generate overviews (basically mip maps stored in the
|
2004-08-14 23:42:01 +08:00
|
|
|
.tiff format)
|
2004-08-10 21:19:04 +08:00
|
|
|
via: <br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><span style="font-weight: bold;">gdal_translate
|
|
|
|
ps_height_16k.png
|
|
|
|
ps_height_16k.tif </span><br>
|
|
|
|
<span style="font-weight: bold;">gdaladdo -r average ps_height_16k.tif
|
|
|
|
2 4 8 16 32 </span><br style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;"> </span><br
|
|
|
|
style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;">gdal_translate ps_texture_16k.png
|
|
|
|
ps_texture_16k.tif </span><br style="font-weight: bold;">
|
|
|
|
g<span style="font-weight: bold;">daladdo -r average ps_texture_16k.tif
|
|
|
|
2 4 8 16 32 </span><br style="font-weight: bold;">
|
|
|
|
</div>
|
|
|
|
<span style="font-weight: bold;"> </span><br>
|
|
|
|
<br>
|
|
|
|
8) Now its time to run the osgdem example to generate your PagedLOD
|
|
|
|
database, the more levels you generate the longer it will take
|
2004-08-14 23:42:01 +08:00
|
|
|
(exponentially so). 'osgdem' is just a front end to osgTerrain::DataSet
|
2004-08-10 21:19:04 +08:00
|
|
|
where all the hard work happens. Here's what to run : <br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><span style="font-weight: bold;">osgdem
|
|
|
|
--xx 10 --yy 10 -t ../ps_texture.tif \</span><br
|
|
|
|
style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;">
|
|
|
|
|
|
|
|
--xx 10 --yy 10 -d ../ps_height.tif \</span><br
|
|
|
|
style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;">
|
|
|
|
|
|
|
|
-l 8 \</span><br style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;">
|
|
|
|
-v 0.1 \</span><br style="font-weight: bold;">
|
|
|
|
<span style="font-weight: bold;">
|
2004-08-14 23:42:01 +08:00
|
|
|
-o puget.ive</span><br>
|
2004-08-10 21:19:04 +08:00
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
Then go away for lunch, afternoon and tea, as generating this much data
|
|
|
|
takes a while... If you don't wish to wait for the full database then
|
|
|
|
reduce the number of levels it generates by setting the -l option to a
|
|
|
|
lower value such as 3.<br>
|
|
|
|
<br>
|
|
|
|
The command line options used above are: <br>
|
|
|
|
<div style="margin-left: 40px;"> <br>
|
|
|
|
The first part the --xx and --yy is specifying the size of the pixels
|
|
|
|
in meters, since these png/tif don't have any geospatial data of their
|
2004-08-14 23:42:01 +08:00
|
|
|
own, if you have geospatialised files then you won't need this.<br>
|
2004-08-10 21:19:04 +08:00
|
|
|
<br>
|
|
|
|
The second part -t <filename> is the option for specificing the
|
2004-08-14 23:42:01 +08:00
|
|
|
texture maps to use, you can use as many times as you wish,
|
2004-08-10 21:19:04 +08:00
|
|
|
osgTerrain::DataSet will moziac them into a single database. <br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
The third part -d is the option for specifying the digital elevation
|
2004-08-10 21:19:04 +08:00
|
|
|
maps to use, as with the textures you can use as many as you like. <br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
The -l option specificies the maximum number of levels to generate. If
|
2004-08-10 21:19:04 +08:00
|
|
|
you use a large number then the database generation will stop once the
|
2004-08-14 23:42:01 +08:00
|
|
|
max resolution of your source data is matched by the resulting database.
|
2004-08-10 21:19:04 +08:00
|
|
|
The database generation will decend further where there is high res
|
|
|
|
source
|
|
|
|
data, decend less where there is lower res data. <br>
|
|
|
|
<br>
|
|
|
|
The -v option specifies the scaling factor which the height is
|
|
|
|
multiplied by.<br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
And finally the -o <filename> is the output format to generate the
|
2004-08-10 21:19:04 +08:00
|
|
|
databases in. This will be the name of the topmost file in the one you
|
|
|
|
should load. It can be a .ive or a .osg. The .ive is faster and has
|
|
|
|
embedded files. <br>
|
|
|
|
</div>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
9) Time to play. Simply load the database in your app (make sure it
|
|
|
|
supports the osgDB::DatabasePager - see osgsimplepager
|
|
|
|
example for details). The standard osgviewer works just fine so,
|
2004-08-10 21:19:04 +08:00
|
|
|
here goes: <br>
|
|
|
|
<br>
|
|
|
|
<span style="font-weight: bold;">osgviewer output.ive </span><br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
10) You don't actually have to wait for osgdem to complete before you
|
|
|
|
can browse the database, since osgdem generates
|
|
|
|
the topmost tiles first. Its not totally robust since osgviewer can end
|
|
|
|
up
|
|
|
|
loading tiles that are still being written by osgdem, but it doesn't
|
|
|
|
crash
|
|
|
|
here under Linux, so you might be lucky too. <br>
|
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
11) If your imagery and DEMs have geospatial coords associated with
|
|
|
|
them then the -xx, --yy and -v options will not be required, making
|
2004-08-10 21:19:04 +08:00
|
|
|
it much simplier to specify - you just need to specifiy options such as
|
|
|
|
<span style="font-weight: bold;">-t imge.tif</span> and -d terran.dt0
|
2004-08-14 23:42:01 +08:00
|
|
|
without any need to set the coordinate system.<br>
|
2004-08-10 21:19:04 +08:00
|
|
|
<br>
|
2004-08-14 23:42:01 +08:00
|
|
|
12) osgdem can automatically handle mosaicing of sets of files. These
|
2004-08-10 21:19:04 +08:00
|
|
|
can be specified via a sequence of <span style="font-weight: bold;">-t
|
|
|
|
<filename></span> and <span style="font-weight: bold;">-d
|
|
|
|
<filename></span> pairs on the commandline, or via <span
|
|
|
|
style="font-weight: bold;">-t <directoryname></span> and <span
|
|
|
|
style="font-weight: bold;">-d <directoryname>.</span><br>
|
|
|
|
<br>
|
|
|
|
<hr style="width: 100%; height: 2px;">
|
|
|
|
<h3><a name="osgdem_options"></a>osgdem options</h3>
|
|
|
|
There are of osgdem options to use, to list the full ranges of options
|
|
|
|
do:<br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><span style="font-weight: bold;">osgdem
|
|
|
|
--help</span><br>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
And you should see:<br>
|
|
|
|
<br>
|
|
|
|
<div style="margin-left: 40px;"><br>
|
|
|
|
<span style="font-family: monospace; font-weight: bold;">osgdem --help</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">Usage: osgdem [options] filename
|
|
|
|
...</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">Options:</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--HEIGHT_FIELD
|
|
|
|
Create a height field database</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--LOD
|
|
|
|
Create a LOD'd database</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--POLYGONAL
|
|
|
|
Create a height field database</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--PagedLOD
|
|
|
|
Create a PagedLOD'd database</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--RGB-16
|
|
|
|
Use 16bit RGB destination imagery</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--RGB-24
|
|
|
|
Use 24bit RGB destination imagery</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--comment
|
|
|
|
Added a comment/description string to</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
the top most node in the dataset</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--compressed
|
|
|
|
Use OpenGL compression on destination</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
imagery</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> --cs <coordinates
|
|
|
|
system string> Set the
|
|
|
|
coordinates system of source</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
imagery, DEM or destination database.</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
The string may be any of the usual</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
GDAL/OGR forms, complete WKT, PROJ.4,</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
EPS</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--max-anisotropy
|
|
|
|
Max anisotropy level to use when</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
texturing, defaults to 1.0.</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--max-visible-distance-of-top-level Set the
|
|
|
|
maximum visible distance that</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
the top most tile can be viewed at</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--mip-mapping-hardware
|
|
|
|
Use mip mapped textures, and generate</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
the mipmaps in hardware when</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
available.</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--mip-mapping-imagery
|
|
|
|
Use mip mapped textures, and generate</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
the mipmaps in imagery.</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--no-mip-mapping
|
|
|
|
Disable mip mapping of textures</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--radius-to-max-visible-distance-ratio Set the maximum visible
|
|
|
|
distance ratio</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
for all tiles apart from the top most</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
tile. The maximum visuble distance is</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
computed from the ratio * tile radius.</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> --skirt-ratio
|
|
|
|
<float>
|
|
|
|
Set the ratio of skirt height to tile</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
size</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--tile-image-size
|
|
|
|
Set the tile maximum image size</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
--tile-terrain-size
|
|
|
|
Set the tile maximum terrain size</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> --wkt <WKT
|
|
|
|
string>
|
|
|
|
Set the coordinates system of source</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
imagery, DEM or destination database</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
in WellKownText form.</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> --wkt-file <WKT
|
|
|
|
file>
|
|
|
|
Set the coordinates system of source</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
imagery, DEM or destination database</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
by as file containing WellKownText</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
definition.</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -d
|
|
|
|
<filename>
|
|
|
|
Specify the digital elevation map</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
input file to process</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -e <x> <y>
|
|
|
|
<w>
|
|
|
|
<h>
|
|
|
|
Extents of the model to generate</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -h or
|
|
|
|
--help
|
|
|
|
Display this information</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -l
|
|
|
|
<numOfLevels>
|
|
|
|
Specify the number of PagedLOD levels</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
to generate</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -m
|
|
|
|
<filename>
|
|
|
|
Specify the 3D database model input</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
file to process</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -o
|
|
|
|
<outputfile>
|
|
|
|
Specify the output master file to</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
generate</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;"> -t
|
|
|
|
<filename>
|
|
|
|
Specify the texture map input file to</span><br
|
|
|
|
style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
process</span><br style="font-family: monospace;">
|
|
|
|
<span style="font-family: monospace;">
|
|
|
|
-v
|
|
|
|
Set the vertical multiplier</span><br style="font-family: monospace;">
|
|
|
|
<br style="font-family: monospace;">
|
|
|
|
<br>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|