VIRTUALPLANETBUILDER (vpb) osgdem 用法

来源:互联网 发布:安卓查看网站源码 编辑:程序博客网 时间:2024/06/07 03:44

原文地址:http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/osgdem

      osgdem

osgdem 是一个工具程序 用于读取地理空间图像 和 高程图,生成大规模的3D地形数据库 ,  OpenSceneGraph应用程序能够加载实时浏览 . 一下是osgdem 的步骤指导, 以下是完整的步骤.

Quick step by step guide

以下步骤需要编译得到 VirtualPlanetBuilder/osgdem ,举例如何用osgdem 处理影像和DEM数据 生成分页数据库.

1. 下载,编译 和安装 GDAL, 和 OpenSceneGraph. 然后下载VirtualPlanetBuilder.

2. For UNIX 'make' users:

cd VirtualPlanetBuilder./configuremakesudo make install

3. 哦, 确保你有GB以上数据空间,因为你将会需要它:-)

4. 下载一些数据, 例如这个例子我们用 Puget Sound 数据在 at:

http://www.cc.gatech.edu/projects/large_models/ps.html
Download Elevation Map: 16385 × 16385 PNG: 188MB
Download Texture Map: 16384 × 16384 PNG: 268MB

5. 为了避免访问数据走样 (aliasing artifacts)用GDAL 程序工具生成概述(基本的mip maps 存储进 .tiff 格式里),通过一下命令:

gdal_translate ps_height_16k.png ps_height_16k.tifgdaladdo -r average ps_height_16k.tif 2 4 8 16 32gdal_translate ps_texture_16k.png ps_texture_16k.tifgdaladdo -r average ps_texture_16k.tif 2 4 8 16 32

6. 现在是时候运行osgdem例子去生成你的PagedLOD数据库了,, 越多的水平及生成的时间将长. 所有的工作开始的时候 'osgdem' 仅仅是osgTerrain::DataSet 的前端('osgdem' is just a front end toosgTerrain::DataSet where all the hard work happens) . 运行一下命令 :

osgdem --xx 10 --yy 10 -t ps_texture_16k.tif \ --xx 10 --yy 10 -d ps_height_16k.tif \ -l 8 -v 0.1 -o puget.ive -a pegout.osga

 

7   然后去吃午饭,下午茶, 因为生成这些大量数据需要一些时间.如果你不想为了全部的数据库而等待,那么减少生成的水平级,通过设置-l 选项减少值 比如.

上面用过的命令行选项是:
第一部分 --xx 和 --yy 是指定一米内像素的尺寸, 由于这些 png/tif 没有任何地理空间数据,,如果你有地理空间文件那么你将不需要这些... 

第二部分  -t <filename>是指定使用的纹理贴图名的选项, 你可以随意使用多次, osgTerrain::DataSet will 镶嵌(moziac )他们到单个数据库里. 

第三部分 -d  选项是指定使用的数字高程图 , 与纹理贴图一样你可以使用一样多次数.

The -l 选项指定生成层次最大数. 如果您使用了大量数据库生成将停止您的源数据最大分辨率生成的数据库匹配数据库生成哪里有高分辨率数据进一步下降,下降那里较低水库数据If you use a large number then the database generation will stop once the max resolution of your source data is matched by the resulting database. The database generation will descend further where there is high res source data, descend less where there is lower res data.

The -v 选项指定缩放因素高程图是多层地 .

] The -o <filename>是生成数据输出格式 . 这是顶端文件名 你可以加载的.它可以是  a .ive or a .osg. The .ive is 最快的嵌入文件. 

最后地 -a <filename> 告诉osgdem 写所有瓦片到一个三个的存档文件,在这一 OpenSceneGraph 本地档案格式, 用扩展名.osga 区分他自己. 使用存档不是必须的 ,但是是推荐的 因为管理整个数据库更加方便- 你用一个单个文件管理而不是数十个千记的大型数据库.

7.   玩的时间 .简单的加载数据库到你的应用程序  ,如果你有比喻osgViewer::Viewer or CompositeViewer 所有的分页是内置支持的. 标准的 osgviewer 就好, 如下: 

  osgviewer pegout.osga


8. 如果你的影像和DEMs 有地理空间坐标关联 那么the -xx --yy 和 -v 选项将不是必须的, 使它更简单去指定- 你只需要指定选项 比如-t imge.tif  和  -d terran.dt0 没有任何需要设定的坐标系统.

9. osgdem 可以自动地处理拼接设置文件. 这些能够通过一个序列指定  一对命令如: -t <filename> 和 -d <filename>  , 或者通过 -t <directoryname> 和 -d <directoryname>.

命令行选项¶

See [CommandLineOptions]

VPB源文件用法¶

写入所有osgdem 选项到一个VPB 源文件, 然后用这个源文件随后运行, 这意味着你能够避免 所有的啰嗦选项在你实验的时候 如下:

// Create the build.source fileosgdem --bluemarble-west -t ../land_shallow_topo_west.tif \           --bluemarble-east -t ../land_shallow_topo_east.tif \           --geocentric \           -o earth/earth.ive \           --so build.source// run the buildosgdem -s build.source// have a look at the file - it's just an extended form of a .osg filecat build.source// override the number of levelsosgdem -s build.source -l 4// run build adding your extra imageryosgdem -s build.source -t MyOrthoImage.tif

坐标系技巧¶

WKT 坐标系定义格式是一个非常全面的, 但是很难使用"human enter-able"指定定坐标系统. osgdem 使用GDAL在引擎盖下,允许使用定义格式--cs flag in PROJ4 format. PROJ4的定义格式是更友好.
例子:

  • 对于一个纬度(Latitude) (Y Axis), 经度(Longitude) (X Axis) 和高度坐标系 在角度单位里: osgdem ... --cs "+proj=latlong +datum=WGS84" -o ...
  • 对于一个 UTM坐标系统参考地区47(in this example)米为单位使用: osgdem ... --cs "+proj=utm +zone=47" -o ...
  • 对于一个 Geocentric system(地心系统), 远点为地球的中心 ,单位米  使用 :osgdem ... --geocentric -o ...