osgearth 缓存文件

osgearth 缓存文件

1、osgearth 缓存文件变化

转自:http://blog.sina.com.cn/s/blog_803fc5eb01010mez.html

旧版本中,有TMSCache类,可以对缓存路径做以下设置:
        osgEarth::TMSCacheOptions cacheOptions;
        cacheOptions.setPath(strCache);
        map->setCache(new osgEarth::TMSCache(cacheOptions));
在新版本中,由于较大的改变,不在存在TMSCache类,应该进行一下代码编写:    

       osgEarth::Drivers::FileSystemCacheOptions cacheOpts; 
       cacheOpts.rootPath() = "./osgearth_cache/";
       osgEarth::MapOptions mapOpts; 
       mapOpts.cache() = cacheOpts;
       osgEarth::Map* map = new osgEarth::Map(mapOpts)

2、osgearth 地图切片

转自:http://blog.sina.com.cn/s/blog_803fc5eb01010l59.html

        http://blog.sina.com.cn/s/blog_803fc5eb01010ptd.html

1、osgearth_package 方法多用于发布网络数据,可把地图数据切片生成png,jpg以及tif格式,可以使用tms驱动进行缓存文件的加载。
2、osgearth_seed 方法多用于本地文件的管理,将地图切片保存到.osgb中(即osgearth binary),cache type 为filesystem 类型。
我们可以设置
  <image name="haiyan3" driver="gdal" cacheid = "haiyan3" cache_only="true">
            <url>../haiyan/haiyan3.tif</url>   
            <transparent_color>0 0 0 0</transparent_color>               
            <tile_size>256</tile_size>
  </image>   
即只读缓存文件,以加快文件的读取效率。

应该尽量把地图切片切成同样大小,以利于加载,否则,可能在利用osgviewer显示的时候进行重新切片,造成显示速度变慢。对于高程数据,切片更应该小些,应在16*16,或者32*32范围内,以利于加载显示。

posted @ 2016-01-22 09:11  flylong0204  阅读(3026)  评论(0)    收藏  举报