TMS服务生成---osgearth_package

        web 端使用ogc地图服务相对较多,但是osgearth天生支持的tms服务,用于osgearth开发中会更方便。当然工具使用的前提是要先编译安装osg及osgearth到自己电脑上。不然无法使用该工具,这不是本篇重点。osgearth_package可以用来进行影像切片(jpg,png)和地形切片(tif)。osgearth

主要过程如下

1、创建earth文件,将地形文件或者影像文件按规则添加,可以从demo的earth 文件作为基础进行修改,注意osg和osgearth的版本oe的2.X 版本跟3.x版本编写方式有较大的区别,我这里是osg3.4和osgearth2.7的版本,参考官方文档:http://docs.osgearth.org/en/2.10/user/earthfiles.html 我的文件如下:

常用工具可以查看官网文档;http://docs.osgearth.org/en/2.10/user/tools.html#


<map type="geocentric" version="2">

    <!--image driver="gdal" name="world-tiff">
        <url>./world.tif</url>
    </image-->
<!--image name="mapquest_taiwan" driver="xyz" max_level="18">
        <url>http://1xxxxxx:8000/taiwanimg/{z}/{x}/{y}.jpg</url>
        <profile>global-mercator</profile>
    </image-->
<!--image name="mapquest_osm" driver="xyz" max_level="18">
        <url>http://xxxxx:8000/shenzhen_osmv/{z}/{x}/{y}.png</url>
        <profile>global-mercator</profile>
    </image-->

    <elevation name = "shenzhen" driver = "gdal">
      <url>D:/geodata/dem_shenzhen_low.tif</url>
    </elevation>

    <options>
        <lighting>true</lighting>
        <cache_policy usage="no_cache"/>
    </options>
   
</map>

为了节省切片时间,这里只加了地形文件,不加载其他图层,因此只会生成一个地形的tms图层的目录,也可将其他注释放开,就能得到相应的图层tms服务。

2、命令行执行,运行后会在指定文件夹生成所有图层对应的tms目录

osgearth_package tms.earth --tms --max-level 15  --out  d:/tms/data

3、切完之后,测试earth文件,通过osgearth_viewer 查看

<map type="geocentric" version="2">

    <image driver="gdal" name="world-tiff">
        <url>./world.tif</url>
    </image>
<image name="mapquest_taiwan" driver="xyz" max_level="18">
        <url>http://xxxx:8000/taiwanimg/{z}/{x}/{y}.jpg</url>
        <profile>global-mercator</profile>
    </image>
<image name="mapquest_osm" driver="xyz" max_level="18">
        <url>http://xxxxx:8000/shenzhen_osmv/{z}/{x}/{y}.png</url>
        <profile>global-mercator</profile>
    </image>

    <!--elevation name = "shenzhen" driver = "gdal">
      <url>d:/geodata/dem_shenzhen_4326.tif</url>
    </elevation-->
<!--heightfield name = "shenzhen" driver = "gdal">
      <url>d:/geodata/dem_shenzhen_4326.tif</url>
    </heightfield-->
<elevation driver="tms" name="shenzhen" url ="D:/geodata/tmstest/shenzhen/tms.xml"></elevation>


    <options>
        <lighting>true</lighting>
        <cache_policy usage="no_cache"/>
    </options>
   
</map>

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值