查看: 1403|回复: 7

求大神赐教啊!为什么省界加载不了

[复制链接]

该用户从未签到

发表于 2017-11-24 14:22:48 | 显示全部楼层 |阅读模式
下面的代码是加载世界国界线和中国省界线的,世界国界线可以加载,中国省界线在使用osgearth_cache命令时报错。
代码如下:
  <image name="world_boundaries" driver="agglite">
    <features name="world" driver="ogr">
      <url>../boundaryData/world.shp</url>
      <build_spatial_index>true</build_spatial_index>
    </features>

    <geometry_type>line</geometry_type>

    <relative_line_size>true</relative_line_size>

    <styles>
      <style type="text/css">
        world{
          stroke:#ffff00;
          stroke-opacity:1;
          stroke-width:1.5;
        }
      </style>
    </styles>
  </image>

  <image name="china_boundaries" driver="agglite">
    <features name="chinap" driver="ogr">
      <url>../boundaryData/china.shp</url>
      <build_spatial_index>true</build_spatial_index>
    </features>

    <geometry_type>line</geometry_type>

    <relative_line_size>true</relative_line_size>

    <styles>
      <style type="text/css">
        chinap{
          stroke:#ffff00;
          stroke-opacity:1;
          stroke-width:1.0;
        }
      </style>
    </styles>
  </image>

osgearth_cache报错如下:
F:\osgEarthData>osgearth_cache --seed boundaries.earth --max-level 4
[osgEarth]  [TerrainLayer] Layer "china_boundaries" Failed to create "agglite" d
river, but a cache may exist, so falling back on cache-only mode.
[osgEarth]* [EarthSerializer2] Layer "china_boundaries" : Error : Failed to open
a cache for layer because cache_only policy is in effect and bin [a2187a80] cou
ld not be located.
[osgEarth]  Seeding layerchina_boundaries
[osgEarth]  Seeding layerworld_boundaries

F:\osgEarthData>
附件是两套文件:

boundaryData.rar

560.86 KB, 下载次数: 14, 下载积分: 威望 1

该用户从未签到

发表于 2017-11-28 08:29:38 | 显示全部楼层
矢量不支持缓存,你是想切片吗?

晟兴地球是osgEarth编辑器,在工具菜单,有矢量切片、图像切片、瓦片拼接、影像下载等工具,可以参考帮助手册,位于doc目录。

下载:www.sxsim.com

该用户从未签到

 楼主| 发表于 2017-11-28 14:46:58 | 显示全部楼层
ago 发表于 2017-11-28 08:29
矢量不支持缓存,你是想切片吗?

晟兴地球是osgEarth编辑器,在工具菜单,有矢量切片、图像切片、瓦片拼 ...

因该是支持的,世界国界线也是shp文件,用osgearth_cache --seed成功生成了缓存并可用osgearth_viewer加载,为什么中国的省界线shp就不能?这两个文件及其附带的都放在了附件里,您能不能给看看到底是怎么回事?

该用户从未签到

发表于 2017-11-29 10:24:14 | 显示全部楼层
本帖最后由 ago 于 2017-11-29 10:29 编辑
GeoPeeker 发表于 2017-11-28 14:46
因该是支持的,世界国界线也是shp文件,用osgearth_cache --seed成功生成了缓存并可用osgearth_viewer加 ...


你是用agglite栅格化矢量层为图像层,这样是可以缓存的,我刚用SXEarth测试了,可以缓存,为了方便观察,可以设置cacheid,也就是缓存文件的根目录名,SXEarth保存的earth文件配置如下:

<?xml version="1.0" ?>
<map>
  <options>
    <terrain attenuation_distance="600000" first_lod="0" tile_size="17" />
    <cache path="cache_dir" type="filesystem" />
  </options>
  <image cacheid="world_boundaries" driver="agglite" enabled="true" geometry_type="line" is2d3d="map_2d_3d" name="world_boundaries" relative_line_size="true" visible="true">
    <features build_spatial_index="true" driver="ogr" name="world" url="shps/world.shp" />
    <styles>
      <style type="text/css">world{stroke:#ffff00;stroke-opacity:1;stroke-width:1.5;}</style>
    </styles>
    <cache_policy usage="read_write" />
  </image>
  <image cacheid="china_boundaries" driver="agglite" enabled="true" geometry_type="line" is2d3d="map_2d_3d" name="china_boundaries" relative_line_size="true" visible="true">
    <features build_spatial_index="true" driver="ogr" name="chinap" url="shps/chinashp.shp" />
    <styles>
      <style type="text/css">chinap{stroke:#ffff00;stroke-opacity:1;stroke-width:1.0;}</style>
    </styles>
    <cache_policy usage="read_write" />
  </image>
  <extensions>
    <sky driver="simple" />
  </extensions>
</map>

该用户从未签到

 楼主| 发表于 2017-12-3 15:08:39 | 显示全部楼层
ago 发表于 2017-11-29 10:24
你是用agglite栅格化矢量层为图像层,这样是可以缓存的,我刚用SXEarth测试了,可以缓存,为了方便观察 ...

我疑惑的是为什么world.shp文件能栅格化,另一个就不能了,我今天用arcview打开了world.shp,另一个不能栅格化的shp文件arcview居然不认!可能是这个原因吧,难道用arcmap做的shp文件osgEarth就没办法用了吗?真的很疑惑啊。

该用户从未签到

发表于 2017-12-5 16:14:40 | 显示全部楼层
GeoPeeker 发表于 2017-12-3 15:08
我疑惑的是为什么world.shp文件能栅格化,另一个就不能了,我今天用arcview打开了world.shp,另一个不能 ...

arcview打不开,可能你这个shp有问题,osgEarth不支持正常。

该用户从未签到

 楼主| 发表于 2017-12-6 07:30:11 | 显示全部楼层
ago 发表于 2017-12-5 16:14
arcview打不开,可能你这个shp有问题,osgEarth不支持正常。

应该有某种机制打开,我昨天重新从ArcMap上输出来一个只有国界线的shp图,没有什么问题的,osgEarth还是一样打不开。另外从网上下载的一些文件也是打不开,但其他网友说能打开,我怀疑是不是osgEarth2.8有什么限制了?我没有能力研究太多源码。也不知道是不是这样。

该用户从未签到

发表于 2017-12-20 09:26:12 | 显示全部楼层
GeoPeeker 发表于 2017-12-6 07:30
应该有某种机制打开,我昨天重新从ArcMap上输出来一个只有国界线的shp图,没有什么问题的,osgEarth还是 ...

和依赖的三方库有关系,gdal的版本太老,也可能无法加载新的shp文件
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表