zoukankan      html  css  js  c++  java
  • osgearth介绍

     

    osgEarth为开发osg应用提供了一个地理空间SDK和地形引擎.

    osgEarth的目标:

    l 提供基于osg开发3D地理空间应用的支持;

    l 直接从数据源可视化地形模型和影像变得更加简单;

    l 提供对开放式绘图标准,技术和数据的交互操作;

    在很多情形下,osgEarth可以替代离线地形数据库创建工具,你可以通过osgEarth完成如下工作:

    获取地形基础地图并快速而流畅的运行

    访问开放式标准的地图数据服务,例如WMS和TMS

    将基于web服务的影像数据和本地存储的数据整合

    在运行时嵌入新的地理空间数据层

    超时处理可能改变的数据

    集成商业数据源

    社区资源

    osgEarth是一个自由开源的SDK,任何人斗可以获取源码,同时欢迎和鼓励参与社区的测试,新功能研发和bug修复.


    工具

    osgEarth自带很多协助处理earth文件和地理空间数据的工具.
    osgearth_viewer
    从命令行加载并显示一个地图.osgEarth提供的地球操纵器用于控制相机,对地理空间数据的浏览进行了优化.

    osgearth_version

    显示osgEarth的当前版本号.

    osgearth_cache

    管理osgEarth的缓存.osgearth_cache较常用的用法:通过非交互方式--seed参数生成缓存信息.

    osgearth_cache --seed file.earth

    osgearth_package

    从earth文件创建一个基于TMS格式,可重复发布的包。

    osgearth_package --tms file.earth --out package

    osgearth_conv

    将瓦片源中到内容拷贝到另一个文件。所有参数以键值对方式出现,需要为每个驱动选项查找头文件。当然,输出驱动必须支持写(通过实现ReadWriteTileSource接口)。"in"属性来自于GDALOptions getConfig方法。"out"属性来自于MBTilesOptions getConfig方法。

    osgearth_conv --in driver gdal --in url world.tif --out driver mbtiles --out filename world.db

    osgearth_tfs

    从特征源(例如shapefile)产生一个TFS数据集。通过将源预处理成网格结构(TFS),可极大提升大数据集的性能。同时,产生的TFS包可由web服务器提供服务。

    osgearth_tfs filename

    osgearth_backfill

    用于后期处理TMS数据集的特殊工具。一些web地图服务在不同缩放比例下会使用完全不同的数据集。例如,当缩放比例达到4级时,可能使用NASA 的BlueMarble,然后陡然切换到地球资源卫星数据。在2D场景下,对于较光滑的地图有效,但是在3D场景下,整张图看起来会很不均匀,因为在不同的LODs下,相邻的瓦片看起来会完全不同。

    Osgearth_backfill产生一个TMS数据集(使用osgearth_package或其他工具),然后从指定的查看高度填充较低缩放级别的细节。例如,你可以指定最大缩放级别10,0-9的lods就可以从10级的数据重新生成。

    osgearth_boundarygen

    产生边界地理信息,可使用osgEarth<mask> 将外部模型数据嵌入地形信息中。

    osgearth_boundarygen model_file [options]

    osgearth_overlayviewer

    调试叠加功能。运行时显示两个窗口,一个显示普通的地图视图,一个显示包含边界的视锥体视图(用于叠加计算)。

    osgearth_graticule

    加载经纬线

    地图

    Osgearth提供了大量的地图文件,每个文件都对应某类功能,可通过osgearth_viewer查看运行效果。

    Feature_drapped_lines.earth: 显示国界线

    Feature_clip_plane.earth: 显示透明地球+国界线

    Feature_custom_filters.earth: 根据缩放级别动态显示国名

    Feature_drapped_polygons.earth: 相邻国家使用不同颜色显示

    Feature_models.earth: 紧贴地表绘制的三维图形

    Graticule.earth: 显示经纬线及经纬线位置(包含较清晰高层数据,未穿越云层)

    Ldb.earth: 在地球某一高度显示一只静态的飞机

    实例

    以下地图文件基于osgearth提供的数据,包含一个地球、经纬线、国界线、各国名字。

    1.  
      <!--
    2.  
      osgEarth Sample
    3.  
       
    4.  
      Demonstrates feature draping using projective texturing,
    5.  
      i.e. "altitude-clamping: terrain-drape".
    6.  
      -->
    7.  
       
    8.  
      <map name="Geometry Rasterizer Demo" type="round" version="2">
    9.  
       
    10.  
      <options>
    11.  
      <lighting>false</lighting>
    12.  
      <terrain min_lod="16"/>
    13.  
      </options>
    14.  
       
    15.  
      <image name="world" driver="gdal">
    16.  
      <url>../data/world.tif</url>
    17.  
      <cache_policy usage="no_cache"/>
    18.  
      </image>
    19.  
       
    20.  
      <model name="world_boundaries" driver="feature_geom">
    21.  
       
    22.  
      <features name="earth" driver="ogr">
    23.  
      <url>../data/world.shp</url>
    24.  
      <build_spatial_index>true</build_spatial_index>
    25.  
      </features>
    26.  
       
    27.  
      <styles>
    28.  
      <style type="text/css">
    29.  
      world {
    30.  
      stroke: #ffff00;
    31.  
      stroke- 5px;
    32.  
      altitude-clamping: terrain-drape;
    33.  
      }
    34.  
      </style>
    35.  
      </styles>
    36.  
       
    37.  
      </model>
    38.  
       
    39.  
      <extensions>
    40.  
      <graticule>
    41.  
      <!-- The approximate number of grid lines that you would like to see in your view extent.
    42.  
      This number, along with the resolutions list, will be used to select a resolution on each view.
    43.  
      -->
    44.  
      <grid_lines>10</grid_lines>
    45.  
       
    46.  
      <!-- The grid resolutions, in degrees that you want to see, all separated by a space and sorted from lowest resolution to highest -->
    47.  
      <!--
    48.  
      <resolutions>10 5 2.5 1.25</resolutions>
    49.  
      -->
    50.  
       
    51.  
      <!-- The grid line color -->
    52.  
      <color>#f7a73f70</color>
    53.  
       
    54.  
      <!-- The label color -->
    55.  
      <label_color>#ffff00ff</label_color>
    56.  
       
    57.  
      <!-- Specify the line width -->
    58.  
      <line_width>2</line_width>
    59.  
      </graticule>
    60.  
      </extensions>
    61.  
       
    62.  
      <model name="cities" driver="feature_geom">
    63.  
       
    64.  
      <features name="cities" driver="ogr">
    65.  
      <url>../data/world.shp</url>
    66.  
       
    67.  
      <!--Define a ChangeAttributeFilter, which is defined in the osgearth_featurefilter example. This will change the cntry_name of all countries to osgEarthLand.-->
    68.  
      <change_attribute key="cntry_name" value="osgEarthLand"/>
    69.  
      </features>
    70.  
       
    71.  
      <styles>
    72.  
      <style type="text/css">
    73.  
      cities {
    74.  
      text-provider: annotation;
    75.  
      text-content: [cntry_name];
    76.  
      text-priority: [pop_cntry];
    77.  
      text-halo: #3f3f7f;
    78.  
      text-align: center_center;
    79.  
      text-declutter: true;
    80.  
      }
    81.  
      </style>
    82.  
      </styles>
    83.  
       
    84.  
      </model>
    85.  
       
    86.  
       
    87.  
      </map>

    第15行加载地球模型,第20行加载国界,第39行加载经纬线,第62行加载国名。

  • 相关阅读:
    OpenCV 创建Mat图像
    OpenCV Mat数据类型及位数总结
    OpenCV 使用at和ptr指针访问像素的区别
    OpenCV 16位深度图片显示并保存
    PyCharm 安装教程(Windows)
    Qt 安装图解(Windows平台)
    Qt 下载(多种下载通道+所有版本)
    QtCreator怎样编辑运行Python脚本
    Python 怎么运行代码
    Qt for Python 怎样搭建开发环境
  • 原文地址:https://www.cnblogs.com/liaocheng/p/9237354.html
Copyright © 2011-2022 走看看