osgearth介绍

介绍

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

osgEarth的目标:

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

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

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

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

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

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

将基于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或其他工具),然后从指定的查看高度填充较低缩放级别的细节。例如,你可以指定最大缩放级别100-9lods就可以从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提供的数据,包含一个地球、经纬线、国界线、各国名字。

<!--
osgEarth Sample

Demonstrates feature draping using projective texturing, 
i.e. "altitude-clamping: terrain-drape".
-->

<map name="Geometry Rasterizer Demo" type="round" version="2">
  
    <options>
        <lighting>false</lighting>
        <terrain min_lod="16"/>
    </options>

    <image name="world" driver="gdal">
        <url>../data/world.tif</url>
        <cache_policy usage="no_cache"/>
    </image>
    
   <model name="world_boundaries" driver="feature_geom">

        <features name="earth" driver="ogr">
            <url>../data/world.shp</url>
            <build_spatial_index>true</build_spatial_index>
        </features>

        <styles>
            <style type="text/css">
                world {
                   stroke:             #ffff00;
                   stroke-width:       5px;
                   altitude-clamping:  terrain-drape;
                }
            </style>
        </styles>

    </model>

    <extensions>
        <graticule>
            <!-- The approximate number of grid lines that you would like to see in your view extent.
                 This number, along with the resolutions list, will be used to select a resolution on each view.
             -->
            <grid_lines>10</grid_lines>

            <!-- The grid resolutions, in degrees that you want to see, all separated by a space and sorted from lowest resolution to highest -->
            <!--
            <resolutions>10 5 2.5 1.25</resolutions>
             -->

            <!-- The grid line color -->
            <color>#f7a73f70</color>

            <!-- The label color -->
            <label_color>#ffff00ff</label_color>

            <!-- Specify the line width -->
            <line_width>2</line_width>
        </graticule>
    </extensions>

    <model name="cities" driver="feature_geom">

        <features name="cities" driver="ogr">
            <url>../data/world.shp</url>

                        <!--Define a ChangeAttributeFilter, which is defined in the osgearth_featurefilter example.  This will change the cntry_name of all countries to osgEarthLand.-->
                        <change_attribute key="cntry_name" value="osgEarthLand"/>
        </features>

        <styles>
            <style type="text/css">
                cities {
                   text-provider:  annotation;
                   text-content:   [cntry_name];
                   text-priority:  [pop_cntry];
                   text-halo:      #3f3f7f;
                   text-align:     center_center;
                   text-declutter: true;
                }
            </style>
        </styles>

    </model>

  
</map>

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

 

osgEarth 的 121 个案例详解 osgEarth 的 121 个案例详解 ...........................................................................................................1 1. aeqd.earth.................................................................................................................................4 2. annotation.earth .......................................................................................................................5 3. annotation_dateline.earth........................................................................................................6 4. annotation_dateline_projected.earth ......................................................................................8 5. annotation_flat.earth................................................................................................................8 6. arcgisonline.earth .....................................................................................................................9 7. bing.earth................................................................................................................................10 8. boston.earth............................................................................................................................11 9. boston_buildings.earth ...........................................................................................................12 10. boston_projected.earth ..................................................................................................13 11. boston_tfs.earth..............................................................................................................14 12. boston-gpu.earth ............................................................................................................15 13. bumpmap.earth ..............................................................................................................16 14. clouds.earth ....................................................................................................................17 15. colorramp.earth ..............................................................................................................18 16. contourmap.earth ...........................................................................................................19 17. datum_override.earth.....................................................................................................20 18. day_night_mp.earth........................................................................................................21 19. day_night_rex.earth........................................................................................................21 20. detail_texture.earth ........................................................................................................21 21. errors.earth .....................................................................................................................22 22. fade_elevation.earth.......................................................................................................22 23. feature_clip_plane.earth.................................................................................................23 24. feature_country_boundaries.earth.................................................................................24 25. feature_custom_filters.earth ..........................................................................................25 26. feature_draped_lines.earth ............................................................................................26 27. feature_draped_polygons.earth .....................................................................................27 28. feature_elevation.earth ..................................................................................................28 29. feature_extrude.earth.....................................................................................................29 30. feature_geom.earth ........................................................................................................30 31. feature_gpx.earth............................................................................................................31 32. feature_inline_geometry.earth.......................................................................................32 33. feature_labels.earth........................................................................................................33 34. feature_labels_script.earth.............................................................................................35 35. feature_levels_and_selectors.earth................................................................................35 36. feature_model_scatter.earth ..........................................................................................36 37. feature_models.earth .....................................................................................................37 38. feature_occlusion_culling.earth......................................................................................38osgEarth 编辑器 SXEarth www.sxsim.com 2 39. feature_offset_polygons.earth .......................................................................................38 40. feature_overlay.earth......................................................................................................39 41. feature_poles.earth.........................................................................................................40 42. feature_population_cylinders.earth ...............................................................................40 43. feature_raster.earth ........................................................................................................41 44. feature_rasterize.earth ...................................................................................................41 45. feature_rasterize_2.earth ...............................................................................................42 46. feature_scripted_styling.earth........................................................................................43 47. feature_scripted_styling_2.earth....................................................................................43 48. feature_scripted_styling_3.earth....................................................................................43 49. feature_style_selector.earth ...........................................................................................44 50. feature_tfs.earth .............................................................................................................45 51. feature_tfs_scripting.earth .............................................................................................46 52. feature_wfs.earth............................................................................................................47 53. fractal_elevation.earth....................................................................................................47 54. gdal_multiple_files.earth ................................................................................................47 55. gdal_tiff.earth..................................................................................................................48 56. geomshader.earth ...........................................................................................................49 57. glsl.earth..........................................................................................................................50 58. glsl_filter.earth ................................................................................................................51 59. graticules.earth ...............................................................................................................52 60. hires-inset.earth..............................................................................................................53 61. intersect_filter.earth .......................................................................................................54 62. land_cover_mixed.earth .................................................................................................55 63. layer_opacity.earth .........................................................................................................55 64. ldb.earth..........................................................................................................................56 65. mapbox.earth..................................................................................................................56 66. mask.earth ......................................................................................................................57 67. mb_tiles.earth.................................................................................................................58 68. mercator_to_plate_carre.earth ......................................................................................59 69. mgrs_graticule.earth.......................................................................................................60 70. min_max_level.earth ......................................................................................................60 71. min_max_range.earth.....................................................................................................61 72. min_max_range_rex.earth..............................................................................................62 73. min_max_resolutions.earth............................................................................................62 74. multiple_heightfields.earth.............................................................................................64 75. night.earth.......................................................................................................................65 76. nodata.earth ...................................................................................................................65 77. noise.earth ......................................................................................................................68 78. normalmap.earth ............................................................................................................68 79. ocean.earth .....................................................................................................................69 80. ocean_no_elevation.earth ..............................................................................................69 81. openstreetmap.earth......................................................................................................69 82. openstreetmap_buildings.earth .....................................................................................70osgEarth 编辑器 SXEarth www.sxsim.com 3 83. openstreetmap_flat.earth...............................................................................................70 84. openstreetmap_full.earth...............................................................................................70 85. openweathermap_clouds.earth......................................................................................71 86. openweathermap_precipitation.earth ...........................................................................71 87. openweathermap_pressure.earth ..................................................................................71 88. photosphere1.earth ........................................................................................................71 89. photosphere2.earth ........................................................................................................72 90. readymap.earth...............................................................................................................73 91. readymap_flat.earth .......................................................................................................73 92. readymap_include.earth.................................................................................................74 93. readymap_template.earth..............................................................................................74 94. readymap-elevation-only.earth.......................................................................................74 95. readymap-osm.earth ......................................................................................................75 96. readymap-priority.earth..................................................................................................75 97. readymap-rex.earth ........................................................................................................75 98. roads.earth......................................................................................................................76 99. roads-flattened.earth......................................................................................................76 100. roads-test.earth...............................................................................................................76 101. scene_clamping.earth.....................................................................................................76 102. silverlining.earth..............................................................................................................78 103. simple_model.earth........................................................................................................78 104. skyview1.earth ................................................................................................................79 105. skyview2.earth ................................................................................................................80 106. splat.earth .......................................................................................................................81 107. splat-blended-with-imagery.earth ..................................................................................81 108. splat-with-mask-layer.earth.............................................................................................81 109. splat-with-multiple-zones.earth......................................................................................82 110. splat-with-rasterized-land-cover.earth............................................................................82 111. stamen_toner.earth ........................................................................................................82 112. stamen_watercolor.earth................................................................................................82 113. state_plane.earth............................................................................................................82 114. tess_screen_space.earth.................................................................................................82 115. tess-coastlines.earth .......................................................................................................82 116. tess-terrain.earth ............................................................................................................83 117. triton.earth......................................................................................................................83 118. triton_drop_shader.earth................................................................................................83 119. utm.earth ........................................................................................................................83 120. utm_graticule.earth ........................................................................................................83 121. vertical_datum.earth ......................................................................................................83 122. wms_nexrad.earth ..........................................................................................................84 123. wms-t_nexrad_animated.earth ......................................................................................84 124. 编辑问题总结....................................................................................错误!未定义书签。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值