Recently in the work of an open-source GIS demo, the work involved in the map tiles, the development environment selected is geoserver+openlayers, then the map tile is naturally used Geowebcache, Geowebcache is equivalent to the intermediary between Openlayer and GeoServer, first of all, Geowebcache will be based on your configuration information, the corresponding map layer is cut, stored in the disk, and then when the use of Openlayer load map services, Point the Map service address to Geowebcache,geowebcache after receiving these requests, the corresponding tiles are found in the tile directory according to the requested location and scale, and then returned to you, eliminating the process of dynamically generating the map, and the speed is greatly increased. And because the requested picture resources are generated in advance, the browser load these images, the next time to request the same image, will be pulled from the browser cache, the speed is further improved!
Let's talk about the configuration of Geowebcache for use. First download the war package, after extracting it in Tomcat, you will find a series of configuration files in the Web-inf directory, find the Web. XML, and then add it under the Web-app root element:
<context-param> <param-name>GEOWEBCACHE_CACHE_DIR</param-name> <param-value>d :/data/cache</param-value></context-param>
the value of Param-value is the location where you want to store the Geowebcache tiles, configure here, reboot Tomcat, and you will find some files in your tile directory, There is geowebcache.xml, this file is the key to the Geowebcache configuration, the following is the configuration information for this file:
<?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> & Lt;description>geowebcache is a 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> <s tring>wmts</string> <string>GEOWEBCACHE</string> </keywords> <serviceProvider> <providerName>lzugis</providerName> <providersite>http://blog.csdn.net/gisshixisheng</providersite> <serviceContact> <individualName>lzugis</individualName> <positionnam E>gis Engineers </positionName> <addressType> Engineers </addressType> <addressStreet> &L, no. 3rd, Cui Wei Road, Haidian District t;/addressstreet> <addressCity> Beijing </addressCity> <addressAdministrativeArea> Haidian </addr essadministrativearea> <addressPostalCode>010010</addressPostalCode> <addressCountry> China ,china</addresscountry> <phonenumber>+81 189 1133 7984</phonenumber> <faxNumber>+81 189 1133 7984</faxnumber> <addressEmail>[email protected]</addressEmail> </serviceco ntact> </serviceProvider> <fees>NONE</fees> <accessconstraints>none</accessconstrai Nts> </serviceInformation> <gridSets> <!--Grid Set Example by default epsg:900913 and epsg:4326 a Re Defined-<gridset> <!--This does not has a EPSG code, you can also has multiple gridset elements per SRS--> ; <name>EPSG:4326</name> <srs> <number>4326</number> </srs> <ex tent> <coords> <double>73.45100463600005</double> <double>18.163247188 00007</double> <double>134.976797647</double> <double>53.53194315200005</doub le> </coords> </extent> <scaleDenominators> <double>25000000</double > <double>1000000</double> <double>100000</double> <double>25000< /double> </scaleDenominators> <tileHeight>256</tileHeight> <tilewidth>256</ti lewidth> </gridSet> </gridSets> <layers> <wmsLayer> <name>china</name> <mimeformats> <string>image/gif</string> <string>image/jpeg</string> <string> ;image/png</string> <string>image/png8</string> </mimeFormats> <wmsUrl> <string>http://200.200.200.220:8888/geoserver/wms</string> </wmsUrl> <wmslayers>geos erver:china</wmslayers> </wmsLayer> </layers> </gwcConfiguration>
after configuring the above information, go to: Http://localhost:8080/geowebcache/demo, click "Reload Configuration"re-read the configuration information as follows:
If the configuration information is correct, you will find that the layer information you have configured is already displayed on this page, click " Seed this layer, then you need to enter the following information:
Set it up, and click Submit to start cutting the chart. Open in Explorer, such as:
After the configuration is complete, how to display it in the map, here is the source code that is displayed:
<pre name= "code" class= "HTML" >
The results shown are as follows:
attachment:
Geowebcache-1.5.3-war.zipOr my Baidu network, address: http://pan.baidu.com/s/1kTJt91l
Configuration and use of Geowebcache