Introduction to the OpenGeo Suite

Caching On-Demand

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

  1. In the GeoServer web admin, click Caching Defaults under Tile Caching to see the entries for global caching.

  2. 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.


    Integrated caching settings in GeoServer

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.

  1. Make sure you’re logged in and working with a new map

  2. Click the Add Layers button in the layers window pane.

  3. In the Available Layers panel, click the Add a New Server button.


    Adding a new WMS server

  4. In the URL field, enter the URL of our cached layers:

  5. Click Add Server, to connect to the GeoWebCache server.


    Our WMS server endpoint

  6. 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.

  7. Highlight the layers we added previously from the pure WMS, click Add Layers and then Done.


    Our layers in the GeoExplorer Available Layers dialog

  8. Right-click on the earthgroup, and select Zoom to Layer Extent.


    Layer context menu

  9. You should see a happy map of the world.


    Map with layers added

  10. Click the Export Map icon.

  11. Select your toolbar items, and then click Next to view HTML block used to embed your map in a web page.


    Export map dialog

  12. Copy the <iframe> HTML. We will be pasting this text (or something very similar) into our GNN page:

       style="border: none;" height="400" width="600"
  13. 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.


    HTML source code with two <iframes>

  14. Save your GNN page and refresh your browser.


    A happier web page

  15. 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.


    Two maps, but only one is accelerated

Continue Reading

Previous: Seeding

Next: Part 6: Building Custom Web Map Applications

This Page

About Boundless

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.

Creative Commons License