Geowebcache瓦片的自更新

问题来源

如果有一种图层,它的支撑数据是不断变化的,但使用wms加载太慢(gwc/service/wms也一样),影响体验,那么有没有办法,加载事先切好的瓦片,再自更新更换的部分?

解决方式

  • geoserver官网上提供的两种方式(guava是自带的,而另一种则需要使用社区封装好的依赖包),但两种都试过了,貌似都没有什么效果,也可能是我的方法不对,望大神指点


  • 利用gwc自带的配置进行瓦片时效的调整,用这种方式,本人确实在时长之外感受到了瓦片的变化。

GWC瓦片配置步骤

  • 以防有人不记得所配置的路径,特地介绍了如何找到配置路径,打开geoserver,进入主页,修改地址子路径为gwc(如localhost:8080/geoserver/gwc)。

  • 在xml中添加需要的图层,结构可自行百度geowebcache.xml,有详细的结构,这里不重复,在<layers>下添加所需的wmsLayer.
<layers>
    <wmsLayer>
      <name>随便的名称</name>
      <metaInformation>
        <title>Nicer title for Image States</title>
        <description>This is a description. Fascinating.</description>
      </metaInformation>
      <mimeFormats>
        <string>image/png8</string>
      </mimeFormats>
      <gridSubsets>
        <gridSubset>
          <gridSetName>EPSG:4326</gridSetName>
          <extent>
            <coords>
              <double>106.54</double>
              <double>21.59</double>
              <double>108.26</double>
              <double>23.2</double>
            </coords>
          </extent>
        </gridSubset>
      </gridSubsets>
      <expireCacheList><!--缓存时效-->
        <expirationRule minZoom="0" expiration="60" />
		<expirationRule minZoom="1" expiration="60" />
		<expirationRule minZoom="2" expiration="60" />
      </expireCacheList>
      <expireClientsList><!--客户端时效-->
        <expirationRule minZoom="0" expiration="60" />
		<expirationRule minZoom="1" expiration="60" />
		<expirationRule minZoom="2" expiration="60" />
      </expireClientsList>
      <wmsUrl>
        <string>http://最好外网:端口/geoserver/wms</string>
      </wmsUrl>
      <wmsLayers>工作区:图层名称</wmsLayers>
      <transparent>true</transparent>
      <bgColor>0x0066FF</bgColor>
    </wmsLayer>
  </layers>
  • 然后在第一步的网址里加子路径demo,选中Reload Configuration,进行配置的重新读取
  • 继续下来,要注意的是,配置文件的图层很可能被原来配置的同名图层给顶替掉了,导致结果没有发生变化,这里要删除掉原有图层才能看到GWC图层,如图,图标可以区分,很明显框起来的就是通过配置生成的图层,这个图层可以自更新瓦片。

注意

最大的注意事项就是注意有没有顶替现象
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值