打开缓存文件夹目录下的geowebcache.xml文件。
找到标记<gridSets>,在此条目下创建新的<gridSet>标记。其中必要的子标记是<name>、<srs>、<extent>、<scaleDenominators>、<tileHeight>以及<tileWidth>。其中scaleDenominator标记中的比例尺参数是查看Geoserver中附带的GridSet来帮助制定的。
附上配置成功的EPSG:3857以供参考
<gridSet>
<!-- This does not have to be an EPSG code, you can also have multiple gridSet elements per SRS -->
<name>EPSG:2163</name>
<srs>
<number>2163</number>
</srs>
<extent>
<coords>
<double>-2495667.977678598</double>
<double>-2223677.196231552</double>
<double>3291070.6104286816</double>
<double>959189.3312465074</double>
</coords>
</extent>
<scaleDenominators>
<double>25000000</double>
<double>1000000</double>
<double>100000</double>
<double>25000</double>
</scaleDenominators>
<tileHeight>200</tileHeight>
<tileWidth>200</tileWidth>
</gridSet>
<gridSet>
<name>EPSG:3857</name>
<srs>
<number>3857</number>
</srs>
<extent>
<coords>
<double>-20037508.34</double>
<double>-20037508.34</double>
<double>20037508.34</double>
<double>20037508.34</double>
</coords>
</extent>
<scaleDenominators>
<double>279541131.97544646</double>
<double>139770565.98772323</double>
<double>69885282.99386162</double>
<double>34942641.49693081</double>
<double>17471320.748465404</double>
<double>8735660.374232702</double>
<double>4367830.187116351</double>
<double>2183915.0935581755</double>
<double>1091957.5467790877</double>
<double>545978.7733895439</double>
<double>272989.38669477194</double>
<double>136494.69334738597</double>
<double>68247.34667369298</double>
<double>34123.67333684649</double>
<double>17061.836668423246</double>
<double>8530.918334211623</double>
<double>4265.4591671058115</double>
<double>2132.7295835529058</double>
<double>1066.3647917764529</double>
</scaleDenominators>
<tileHeight>256</tileHeight>
<tileWidth>256</tileWidth>
</gridSet>
配置成功之后就可以在各个<wmsLayer>标记下使用<girdSubset>标记进行调用和微调了。
例:
<wmsLayer>
<name>cite:xzqxz-test-local2</name>
<mimeFormats>
<string>image/gif</string>
<string>image/jpeg</string>
<string>image/png</string>
<string>image/png8</string>
</mimeFormats>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:4326</gridSetName>
</gridSubset>
<gridSubset>
<gridSetName>EPSG:3857</gridSetName>
<extent>
<coords>
<double>-20037508.34</double>
<double>-20037508.34</double>
<double>20037508.34</double>
<double>20037508.34</double>
</coords>
</extent>
</gridSubset>
<gridSubset>
<gridSetName>EPSG:900913</gridSetName>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://localhost:8080/K-TopHighGisServer/wms</string>
</wmsUrl>
<wmsLayers>cite:xzqxz-test-local</wmsLayers>
</wmsLayer>