Geoserver2.16.1配置GeoWebCache 发布ArcGIS Server瓦片

目录

环境搭建:

操作步骤:

1.部署Geoserver

2.启动geoserver

3.部署Geowebcache

4. 浏览服务


参考博文:https://blog.csdn.net/hellfire2007/article/details/80876785

环境搭建:

1.Geoserver - 2.16.1,在http://geoserver.org/release/2.16.1/地址下载版本: Platform Independent Binary

2. GeoWebCache -1.15.1,在https://sourceforge.net/projects/geowebcache/files/geowebcache/1.15.1/ 地址下载版本:geowebcache-1.15.1-war.zip

3.arcgis瓦片松散型。

操作步骤:

1.部署Geoserver

将下载的geoserver-2.16.1-bin.zip,解压,并将解压后的文件夹放在磁盘根目录,如D盘

2.启动geoserver

在bin文件夹双击startup.bat,启动成功,在浏览器输入http://localhost:8080/geoserver/web/,如出现下图,说明部署成功。

ps:默认端口8080,默认用户名/密码:admin/geoserver

3.部署Geowebcache

将下载的geowebcache-1.15.1-war解压,然后再讲解压后的geowebcache.war再解压,得到geowebcache文件夹。

将geowebcache文件夹拷贝到Geoserver下面的webapps中

新建缓存配置目录arcgis(可随意命名,只要和对应web.xml一样即可),并修改web-inf文件夹下的文件web.xml,在</context-param>节点后添加如下节点,记录新建的目录:

 <context-param>
    <param-name>GEOWEBCACHE_CACHE_DIR</param-name>
    <param-value>D:\geoserver-2.16.1\webapps\geowebcache\arcgis</param-value>
  </context-param> 

 

重启服务,会发现该目录下自动生成了几个文件,注意这里的geowebcache.xml

添加ArcGIS切片的路径

修改在上文出现的geoserver-2.16.1\webapps\geowebcache\arcgis\geowebcache.xm文件,在<layer>…</layer>节点中添加如下节点:

注意:启动服务时该配置文件中所有服务对应的切片方案和切片路径必须都存在,否则打不开GeoWebCache主页,显示“503...”,要删去不存在的arcgisLayer节点,并重启服务!
 

 <arcgisLayer>
      <name>SFH_geoserverTest</name>
      <tilingScheme>D:\geoserver-2.16.1\webapps\geowebcache\arcgisTiles\SFH_geoserverTest\Layers\Conf.xml</tilingScheme>
      <tileCachePath>D:\geoserver-2.16.1\webapps\geowebcache\arcgisTiles\SFH_geoserverTest\Layers\_alllayers</tileCachePath>
      <hexZoom>false</hexZoom>
      <storageFormat>esriMapCacheStorageModeExploded</storageFormat>
    </arcgisLayer>

SFH_geoserverTest为服务名,GeoWebCache服务页面中可看到改名字,这里随便起的。conf.xml就是ArcGIS Server发布服务设置缓存后生成的配置文件,该目录就是瓦片所在目录。

4. 浏览服务

再次重启GeoServer,进入GeoWebCache主页:http://localhost:8080/geowebcache/home

在以下链接中可以看到发布的服务:

点击jpeg预览,不能显示,应该是默认用的openlayers3,预览不了。

自己新建一个html页,引用openlayers5,添加如下代码,修改相关属性为自己的服务,就可在浏览器预览成功了。

<!DOCTYPE html>
<html>
  <head>
    <title>WMTS</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v5.3.0/css/ol.css" type="text/css">
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
    <script src="https://openlayers.org/en/v5.3.0/build/ol.js"></script>
  </head>
  <body>
    <div id="map" class="map"></div>
    <script>
       var format = 'image/png';
       var tiled = new ol.layer.Tile({
           //visible: false,
           source: new ol.source.TileWMS({
               url: 'http://localhost:8080/geowebcache/service/wms?SERVICE=WMS&amp',
               params: {
                   'FORMAT': format,
                   'VERSION': '1.0.0',
                    tiled: true,
                   "LAYERS": 'SFH_geoserverTest',
                   "exceptions": 'application/vnd.ogc.se_inimage',
                   
               }
           })
       });
	 
       var view = new ol.View({
           projection:"EPSG:4326",
           zoom: 4,
           center: [123.75,45]
       });
       var map = new ol.Map({
           target: 'map',
           layers: [tiled],
           view:view
       });   
      
    </script>
  </body>
</html>

 

 

 

 

 

 

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值