GeoPeeker 发表于 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
Layer "china_boundaries" Failed to create "agglite" d
river, but a cache may exist, so falling back on cache-only mode.
* Layer "china_boundaries" : Error : Failed to open
a cache for layer because cache_only policy is in effect and bin cou
ld not be located.
Seeding layerchina_boundaries
Seeding layerworld_boundaries

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

ago 发表于 2017-11-28 08:29:38

矢量不支持缓存,你是想切片吗?

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

下载:www.sxsim.com

GeoPeeker 发表于 2017-11-28 14:46:58

ago 发表于 2017-11-28 08:29
矢量不支持缓存,你是想切片吗?

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

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

ago 发表于 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>

GeoPeeker 发表于 2017-12-3 15:08:39

ago 发表于 2017-11-29 10:24
你是用agglite栅格化矢量层为图像层,这样是可以缓存的,我刚用SXEarth测试了,可以缓存,为了方便观察 ...

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

ago 发表于 2017-12-5 16:14:40

GeoPeeker 发表于 2017-12-3 15:08
我疑惑的是为什么world.shp文件能栅格化,另一个就不能了,我今天用arcview打开了world.shp,另一个不能 ...

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

GeoPeeker 发表于 2017-12-6 07:30:11

ago 发表于 2017-12-5 16:14
arcview打不开,可能你这个shp有问题,osgEarth不支持正常。

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

ago 发表于 2017-12-20 09:26:12

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

和依赖的三方库有关系,gdal的版本太老,也可能无法加载新的shp文件
页: [1]
查看完整版本: 求大神赐教啊!为什么省界加载不了