基於Tomcat部署的Geoserver配置Geowebcache,並轉發ArcGIS切片

一、將GeowebCache的war包解壓到tomcat的webapp下,打開war包中的WEB-INF中的web.xml文件,同時建立一個你想保存geowencache的切片的空文件夾,例如我命名叫arcgisjava

                  

web.xml文件中 添加<context-param>節點,param-value是你所建的文件夾web

<context-param>
        <param-name>GEOWEBCACHE_CACHE_DIR</param-name>
        <param-value>D:\Program Files\Apache Tomcat\webapps\geowebcache\WEB-INF\arcgis</param-value>
</context-param>

二、在重啓動tomcat 以後咱們在arcgis文件夾中能夠看到spring

 

 

 三、打開webwebcache.xml文件,在<layer>…</layer>節點中添加以下節點:tomcat

 <arcgisLayer> 
     <name>arcgis_cache</name>
       <tilingScheme>E:\\tile\\arcgis\\Layers\\conf.xml</tilingScheme>
      <tileCachePath>E:\\tile\\arcgis\Layers\\_alllayers</tileCachePath>
      <hexZoom>false</hexZoom>
</arcgisLayer>

四、配置完之後我發現我沒法啓動geowebcache,日誌報錯app

10 四月 18:12:15 (main) WARN [support.XmlWebApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gwcXmlConfig' defined in ServletContext resource [/WEB-INF/geowebcache-core-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No ArcGISCacheGridsetConfiguration could be found
10 四月 18:12:15 (main) ERROR [context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gwcXmlConfig' defined in ServletContext resource [/WEB-INF/geowebcache-core-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No ArcGISCacheGridsetConfiguration could be found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)

網上找到了解決方法webapp

找到geowebcache-core-context文件,往裏面添加url

<bean id="gwcArcGIGridsetConfigutation" class="org.geowebcache.arcgis.layer.ArcGISCacheGridsetConfiguration"/> 

五、加完以後能夠在geowebcache的list中查看到本身添加的瓦片,可是卻不能預覽,比例尺也是1:NANspa

 

 

網上解釋說高版本geowebcache可能沒法預覽,查看他的預覽頁面發現是OL3的庫,由於我用的是OL4的庫,不影響OL或者leaflet加載3d

六、重啓一下服務,刷新一下日誌

   var format = 'image/png';
       var tiled = new ol.layer.Tile({
           //visible: false,
           source: new ol.source.TileWMS({
               url: 'http://localhost:8888/geowebcache/service/wms',
               params: {
                   'FORMAT': format,
                   'VERSION': '1.0.0',
                    tiled: true,
                   "LAYERS": 'arcgis_cache',
                   "exceptions": 'application/vnd.ogc.se_inimage',
                   
               }
           })
       });
       var view = new ol.View({
           projection:"EPSG:4326",
           zoom: 13,
           center: [113.33, 34.01]
       });
       var map = new ol.Map({
           target: 'map',
           layers: [tiled],
           view:view
       });
相關文章
相關標籤/搜索