GeoWebCache的使用和配置

1、GeoWebache切图(默认图层)

1.首先在GeoWebCache官网下载war包,在tomcat中解压后,会在WEB-INF目录下找到一系列配置文件,先找到web.xml,然后在web-app根元素下添加:

    GEOWEBCACHE_CACHE_DIR
    D:/geowebcache/cache

注意,Param-value元素就是要存放GeoWebCache瓦片的位置,可自定义。

2.更改完成后,重启Tomcat,之后在D:/geowebcache/cache下会生成一些文件。其中包含geowebcache.xml,这个文件是geowebcache的配置的关键所在,在最后会贴上参考配置文件信息。

3.tomcat重启之后可以进入:http://localhost:8085/geowebcache,点击Reload Configuration

GeoWebCache的使用和配置_第1张图片
image.png

第一次点击该按钮是会出现登录窗口,配置文件是在WEB-INF下的user.property。

image

geowebcache是用户名,secured是密码,均可自定义。

点击seed this layer。

GeoWebCache的使用和配置_第2张图片
image

设置完毕就开始切图。

可以点开相应的切片地图文件夹进行查看。

GeoWebCache的使用和配置_第3张图片
image
GeoWebCache的使用和配置_第4张图片
image

2.配置外部新的wms图层服务并切图

1.如果要将GeoServer上的WMS服务整合进GeoWebCache中,要执行以下步骤:

打开缓存图片路径下的配置文件geowebcache.xml。在下添加


      cite:load_multiline
      
        image/jpeg
        image/png
      
      
        
          EPSG:4326
          
            
              107.51468029345432
              22.92457922267172
              108.25004930073025
              23.328629643654477
            
          
        
        
          EPSG:4326
        
      
      
        http://192.168.50.35:8080/geoserver/cite/wms
      
    
2.重启tomcat,即可看到配置的新的图层服务,然后点击seed,在配置的缓存文件夹中即可看到切图后的切片文件夹
GeoWebCache的使用和配置_第5张图片
image.png
3.cesium访问GeoWebCache发布的wms服务和wmts服务
            viewer.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
                url: "http://localhost:8085/geowebcache/service/wms",
                layers: 'cite:load_multiline',
                parameters:{
                    format:'image/png'
                }
            }));
viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
                url: "http://localhost:8085/geowebcache/service/wmts?layer=cite:load_multiline&style=&Service=WMTS&Format=image/png&Request=GetTile&Version=1.0.0&tilematrixset={TileMatrixSet}&TileMatrix={TileMatrixSet}:{TileMatrix}&TileCol={TileCol}&TileRow={TileRow}",
                format:'image/png',
                style:'',
                layer:'cite:load_multiline',
                tileMatrixSetID : 'EPSG:4326',
                tilingScheme: new Cesium.GeographicTilingScheme()
            }));

附:参考geowebcache.xml文件




  

  
  1.2.1
  
  120
  
  false
  
  true
  
  
  
  

  

  
  
    
    
      
      image/jpeg
      
      image/png
      
      false
      
      0x0066DD
      
      somepalette
      
      0.9
    
  

  

  
  
    
    
      
      The Entire World
      
      4326
      
      
        
          -180.0
          -90.0
          180.0
          90.0
        
      
      
      false
      
      
           0.703125
           0.3515625
           0.17578125
      
      
      
           25000000
           2500000
           250000
           50000
      
      
      20
      
      111226.31
      
      0.00028
      
      
        Low Resolution
        Medium Resolution
        High Resolution
      
      
      256
      256
    
  

  

  
    
      
      Some Layer
      
      
        A nice title for this layer
        A description of what this data displays
      
      
      image/pngimage/jpeg
      
      ...
      
      
        
          
          The Entire World
          
          
            
              -60.0
              -70.0
              -20.0
              -80.0
            
          
          
          0
          25
        
      
      
      
        
        
          
          http://someserver/georss?layers=somelayer&lastupdate=${lastUpdate}&srs=EPSG:4326
          
          EPSG:4326
          
          600
          
          reseed
          
          image/png
          
          2
          
          11
        
      
      
      
      
      true
      
      http://yourserver/path/wms-service
      
      layer1,layer2
      
      
      
      33
      
      0
      
      application/vnd.ogc.se_xml
      
      1.1.0
      
      false
      
      true
      
      0xFF00AA
      
      
      
      
      
      
        
        
      
      
      
        
        
      
      
      
      
      
      
      false
      
      
    
  

你可能感兴趣的:(GeoWebCache的使用和配置)