总结了网络的各种资料终于成功部署,并加载arcgis wms服务(当然tilecache部署失败了,有时间再试试)
主要修改2个地方(包用的1.5的,目前最新的1.7的部署失败)
1.将geowebcache-1.5.3-war 解压的tomcat webapp下
修改web.xml内容
<context-param>
<param-name>GEOWEBCACHE_CACHE_DIR</param-name>
<param-value>D:/geowebcache/data</param-value>
</context-param>
在<web-app>根目录下添加上面代码
param-value:指定图片缓存位置
2.启动tomcat
在D:/geowebcache/data下会生成如下文件
2.修改geowebcache.xml添加自己的图层服务,进行切图
修改后的内容
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://geowebcache.org/schema/1.5.3"
xsi:schemaLocation="http://geowebcache.org/schema/1.5.3 http://geowebcache.org/schema/1.5.3/geowebcache.xsd">
<version>1.5.3</version>
<backendTimeout>120</backendTimeout>
<serviceInformation>
<title>GeoWebCache</title>
<description>GeoWebCache is an advanced tile cache for WMS servers.It supports a large variety of protocols and
formats, including WMS-C, WMTS, KML, Google Maps and Virtual Earth.</description>
<keywords>
<string>WFS</string>
<string>WMS</string>
<string>WMTS</string>
<string>GEOWEBCACHE</string>
</keywords>
<serviceProvider>
<providerName>John Smith inc.</providerName>
<providerSite>http://www.example.com/</providerSite>
<serviceContact>
<individualName>John Smith</individualName>
<positionName>Geospatial Expert</positionName>
<addressType>Work</addressType>
<addressStreet>1 Bumpy St.</addressStreet>
<addressCity>Hobart</addressCity>
<addressAdministrativeArea>TAS</addressAdministrativeArea>
<addressPostalCode>7005</addressPostalCode>
<addressCountry>Australia</addressCountry>
<phoneNumber>+61 3 0000 0000</phoneNumber>
<faxNumber>+61 3 0000 0001</faxNumber>
<addressEmail>john.smith@example.com</addressEmail>
</serviceContact>
</serviceProvider>
<fees>NONE</fees>
<accessConstraints>NONE</accessConstraints>
</serviceInformation>
<gridSets>
<!-- Grid Set Example, by default EPSG:900913 and EPSG:4326 are defined -->
<gridSet>
<!-- This does not have to be an EPSG code, you can also have multiple gridSet elements per SRS -->
<name>EPSG:4326</name>
<srs>
<number>4326</number>
</srs>
<extent>
<coords>
<double>121.067963</double>
<double>36.699255</double>
<double>122.939758</double>
<double>37.647947</double>
</coords>
</extent>
<scaleDenominators>
<double>18489297.737236</double>
<double>9244648.868618</double>
<double>4622324.434309</double>
<double>2311162.217155</double>
<double>1155581.108577</double>
</scaleDenominators>
<tileHeight>256</tileHeight>
<tileWidth>256</tileWidth>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>GaoDeMapTile</name>
<mimeFormats>
<string>image/png</string>
</mimeFormats>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:4326</gridSetName>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://172.31.170.98:6080/arcgis/services/GaoDeMapTile/MapServer/WMSServer?</string>
</wmsUrl>
<wmsLayers>0</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
当然具体的参数需要自己去查找与自己图层一致的参数(可以参考部署说明(2))
3.我是直接预览的
4.可以查看1中生成的文件夹内容,就是缓存的切片
5.附上openlayer调用显示代码
<pre name="code" class="html"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>openlayer EPSG:4326 image/png</title>
<link rel="stylesheet" type="text/css" href="openlayers/theme/default/style.css"/>
<style type="text/css">
body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
body { border: 0px; margin: 0px; padding: 0px; }
#map { width: 100%; height: 100%; border: 0px; padding: 0px; }
</style>
<script type="text/javascript" src="openlayers/OpenLayers.js"></script>
<script type="text/javascript">
var map, demolayer;
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
function init(){
var mapOptions = {
resolutions: [0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625,
0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 6.866455078125E-4,
3.4332275390625E-4, 1.71661376953125E-4, 8.58306884765625E-5, 4.291534423828125E-5,
2.1457672119140625E-5, 1.0728836059570312E-5, 5.364418029785156E-6, 2.682209014892578E-6,
1.341104507446289E-6, 6.705522537231445E-7, 3.3527612686157227E-7
],
projection: new OpenLayers.Projection('EPSG:4326'),
maxExtent: new OpenLayers.Bounds(-180.0,-90.0,180.0,90.0),
units: "degrees",
controls: []
};
map = new OpenLayers.Map('map', mapOptions );
map.addControl(new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(0, 5)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
demolayer = new OpenLayers.Layer.WMS(
"GaoDeMapTile","http://172.31.170.98:6080/arcgis/services/GaoDeMapTile/MapServer/WMSServer?",
{layers: '0', format: 'image/png' },
{ tileSize: new OpenLayers.Size(256,256)}
);
map.addLayer(demolayer);
map.zoomToExtent(new OpenLayers.Bounds(121.067963, 36.699255,
122.939758, 37.647947)
);
}
</script>
</head>
<body onLoad="init()">
<div id="map"></div>
</body>
</html>