Introduction to the OpenGeo Suite
GeoWebCache is integrated into GeoServer and activated by default. This means that just by using GeoServer, requesting map tiles through WMS, those tiles are stored via the integrated GeoWebCache and are available for future requests.
Turn off automatic caching¶
In the GeoServer web admin, click Caching Defaults under Tile Caching to see the entries for global caching.
For the purposes of this exercise, uncheck the first of the four :guilabel:`Provided Services` (direct integration with GeoServer WMS). This will turn off automatic WMS caching and allow us to see the difference in performance between cached map tiles and uncached map tiles.
In this section we’ll configure a GeoExplorer map to use cached images from GeoWebCache over top of our local WMS, and then compare cached delivery times with full WMS requests.
Adding a GWC Server¶
To publish a cached map, let’s return to GeoExplorer.
Make sure you’re logged in and working with a new map
Click the Add Layers button in the layers window pane.
In the Available Layers panel, click the Add a New Server button.
In the URL field, enter the URL of our cached layers:
Click Add Server, to connect to the GeoWebCache server.
A familiar list of layers will display. The layers in GeoWebCache are the configured GeoServer layers currently being served by GeoServer. This list of layers is identical to both the GeoWebCache configuration page and the GeoServer WMS layer list.
Highlight the layers we added previously from the pure WMS, click Add Layers and then Done.
Right-click on the earthgroup, and select Zoom to Layer Extent.
You should see a happy map of the world.
Click the Export Map icon.
Select your toolbar items, and then click Next to view HTML block used to embed your map in a web page.
Copy the <iframe> HTML. We will be pasting this text (or something very similar) into our GNN page:
<iframe style="border: none;" height="400" width="600" src="http://localhost:8080/geoexplorer/viewer#maps/2"> </iframe>
Return to your text editor and scroll down to about line 32. Above the previous iframe paste the latest HTML code. You should now have two maps in your GNN page: the first served by GeoWebCache, the second served by GeoServer.
Save your GNN page and refresh your browser.
Get your two maps to roughly the same extent. Zoom and pan the first map, and then zoom and pan the second map. You might notice a rendering delay the first time you request a new area on the map that uses caching, but that delay won’t happen if you return to the same area. That is not the case with the original map, where rendering times remain consistently slower.
Boundless provides commercial open source software for internet mapping and geospatial application development. We are dedicated to the growth and support of open source software.
This work is licensed under a Creative Non Commercial-Commons Attribution-Share Alike 3.0 United States License. Feel free to use this material, but we ask that you please retain the Boundless branding, logos and style.