1. Preface
In Webgis, the image pyramid is a very important concept. In the webgis of the principle of the series, I discussed the principle of transduction, addressing the algorithm, the front-end display algorithm, etc., interested friends can see: http://www.cnblogs.com/naaoveGIS/category/600559.html.
I have divided the front-end tiles into two sources, one is online tiles, one is offline tiles. But if we delve into the real source of the tiles, we can't come up to three cutting tools: the ArcGIS transduction tool, the Transduction tool for the Chengguan, and the company's transduction tools. Of course, sometimes we can see the transduction tool or other third-party graph tool for the world map. Here, I'd like to introduce you to another tool for cutting diagrams--geowebcache.
After the geoserver1.7 version, the GeoServer itself integrates the Geowebcache module. This article describes the geoserver2.2 version, which itself comes with a geowebcache. However, if your geoserver version is older, or if you want to use the latest geowebcache, you can download the tool on your own, then follow and configure it according to the instructions, not described here.
2.GeoWebCache Introduction 2.1 General description
Geowebcache (GWC) is an open source project using Java for caching WMS (Web Map Service) tiles. When the map client requests a new map and tile, Geowebcache intercepts the calls and returns the cached tiles. Increase the speed of the map display if the cache is not found and the tiles on the server is called. Achieve a better user experience.
2.2 Feature Description
A.GWC supports tiles from a variety of sources, such as ArcGIS tiles.
B.GWC supports multiple requests, such as WMS, Wms-c, WMTS, TMS, Googl Maps KML, and virtual Earth.
C.GWC supports the mapping of maps in this range to a graph cache based on the configured information when a range of the map is requested for the first time. The second time the same request for this range of maps, directly read the cache tiles for accelerated display. This feature is similar to the AGS dynamic plot.
D.GWC also supports pre-cutting tiles according to the configuration information, the map load directly read tiles. This feature is similar to the AGS tile cache plot.
3. Specific configuration
Because the geoserver that I use itself comes with this feature, the configuration is relatively easy.
3.1 Configuring Tile Storage Address
Add the following configuration to the GeoServer Web. xml file to control the directory where the tiles are stored:
3.2 Tile Details Configuration
After we have configured the address entries in 3.1, reboot Tomcat to find that three files have been generated under the specified tile storage folder:
The Geowebcache.xml is a detailed configuration document for the tiles. This configuration item is important to support the display of tiles that use other sources. However, the current integration version in GeoServer does not support this feature, and the standalone version of Geowebcache can be supported in later chapters to discuss this feature with me.
4. Diagram Operation 4.1. Go to GWC page
After you start Tomcat, enter http://localhost:8680/geoserver/gwc/directly in the browser to enter the following page:
4.2 Select the services that need to be cut
By clicking the list option, you can see the services that can be used to cut graphs:
4.3 Pre-transduction (not required)
If you want to achieve the same effect as all tiles in the AGS, you can click on the seed this layer under the layers you want to slice:
After clicking Submit, start the pre-cut diagram, where you can see the transduction process in the page:
You can see the result of the graph in the tile cache directory:
Note: on the transduction page, you can also stop the graph process:
5. Using the Cut Graph Service 5.1 If our WMS request is a generic URL, can the tile cache service be turned on automatically? --Cannot
Click on Layer Preview in GeoServer to see a certain one of the layers, a URL of:http://localhost:8680/geoserver/wms? layers=tilelayer&styles=&format=image%2fpng&service=wms&version=1.1.1&request=getmap& srs=epsg%3a4326&bbox=104.07920033743,30.648478876565,104.08458074933,30.652787409535&width=512& height=410.
The effect is as follows:
View our tile cache file and do not have any tile cache generation associated with the layer service:
5.2 Can I turn on the tile cache service automatically with a special WMS URL? --Can
Click on the PNG in this item to zoom out in the popup page, a URL is:http://localhost:8680/geoserver/gwc/service/wms? layers=urbanlayer%3atilelayer&format=image%2fpng&service=wms&version=1.1.1&request=getmap& styles=&srs=epsg%3a4326&bbox=104.1943359375,30.5419921875,104.23828125,30.5859375&width=256& height=256
The effect is as follows:
In this case, we can obviously see the corresponding cache generated in the Tile cache folder:
5.3 Summarized by the above example
Compare the URLs of the above two services:
Http://localhost:8680/geoserver/wms |
Http://localhost:8680/geoserver/gwc/service/wms |
You can see that the difference is only when you add Gwc/service to the requested URL, you can turn on the tile cache service.
6. Possible problems 6.1 efficiency issues
If you are using a dynamic cut graph, this is a non-pre-cut graph. When the data that needs to be sliced (layer or group of layers) is large, will the map appear slower for the first time?
6.2 Distortion problem of cut graph effect
Someone on the internet raised the question: the problem is that the image quality of the Geowebcache slice is reduced, the picture pixels are crowded together when zoomed, and there is no picture that shrinks like Windows Picture Viewer or PS to keep it clear.
Original:
GWC Tiles:
Note: in response to this problem, some netizens have given the solution: try to use the Maptiler slicing tool, but the Maptiler tool has limitations and cannot integrate four images.
--Welcome reprint, but retain the copyright, please indicate the source in obvious place: http://www.cnblogs.com/naaoveGIS/
Using Geowebcache to realize the cache optimization of Webgis topographic map display