Geoserver:configuring geowebcache(1)

Services available with GeoWebCache (GWC) in GeoServer

GeoServer, as an open source mapping server compliant with OGC (Open Geospatial Consortium) standards, offers several types of web services for the distribution of geospatial data. One of the key components of this ecosystem is GeoWebCache (GWC), which enhances display performance by caching map tiles.

Two main entry points: /ows and /gwc

1-The /ows entry point

The /ows path is a generic multi-service interface in GeoServer. It enables requests to various OGC services to be centralized via a single URL. This facilitates integration into web clients such as OpenLayers or Leaflet. The services accessible via this entry point are :

WMS (Web Map Service): for the production of dynamic raster maps.

WFS (Web Feature Service): for viewing and editing vector data.

WCS (Web Coverage Service): for access to multi-dimensional raster data (such as time series or raw satellite images).

2-The /gwc entry point

This access point is dedicated to tile services, managed by GeoWebCache, and is mainly used to improve map loading speed by pre-generating and storing tiles. Three services are available:

  • WMS-C (WMS-Cached): a caching-optimized version of WMS.
  • TMS (Tile Map Service): a simple protocol for accessing tiles based on a hierarchical URL structure.
  • WMTS (Web Map Tile Service): a standardized OGC service for distributing map tiles. It is activated by default in GeoServer and is the most suitable service for modern clients such as OpenLayers 3+, QGIS or Leaflet with plug-in.

This modular, optimized operation enables GeoServer to adapt to different use cases, from classic cartographic rendering to the supply of fast tiles for interactive web applications.

Why use OGC standard services (WMS, WFS, WCS, WMTS, etc.)?

1-Interoperability

OGC (Open Geospatial Consortium) services are internationally recognized and interoperable: this means they can be used with various clients such as QGIS, ArcGIS, OpenLayers, Leaflet, MapServer, etc., without any specific configuration.

This facilitates data exchange between organizations, software packages or countries.

2-Standardization & Documentation

OGC services have precise, well-documented specifications, which reduces integration surprises.

For example, a WMS version 1.3.0 will work wherever this protocol is supported.

3-Durability

A standard format is more durable over time. Even if your tool changes, you’ll be able to continue using the services with other solutions.

Why not use (or supplement with) non-standard services?

Performance

Standard OGC services are often more verbose and less efficient than in-house or proprietary solutions.

For example, some companies prefer to distribute tiles via simple TMS (not standardized by OGC) or even via CDN for optimal web front-end performance.

Simplicity or specificity of need

For a highly targeted mobile or web application, you may prefer a REST API or a customized tile service, which is easier to handle than WMTS or WFS.

Control over structure

A customized service can provide more control over data format (simplified GeoJSON, mobile-optimized formats, etc.) than conventional OGC responses.

Good practice often involves combining the two: using OGC services for inter-application exchanges, official data publication and GIS integration, and using non-standard services for the web front-end, REST APIs or rapid tile publication.

Configuring GeoWebCache services

Paragraphe GWC provided services des Paramètres de GeoWebCache

The GWC Provided Services section allows you to activate/configure the various cache services.

1-Enable direct WMS integration

Did you know that you can intercept WMS requests directly with GWC, without even calling on GeoServer’s WMS engine? The “Enable direct WMS integration” option lets you do just that. Here’s why (and when) to use it.

What is direct WMS integration?

When this option is enabled, GeoWebCache catches WMS requests (such as the classic GetMap) before they reach GeoServer. GWC then responds directly with cached tiles, without using the WMS rendering engine. The result: a net gain in performance!

It’s like placing a security guard at the entrance to GeoServer to say: “No need to bother the boss, I’ve already got what you need in stock.”

Why activate it?

  • Boosted performance: no need to generate each WMS image on the fly. Tiles are served instantly from the cache.
  • Server relief: useful for high-load environments, with many simultaneous connections or requests.
  • Total compatibility: traditional clients (QGIS, Leaflet, OpenLayers…) continue to use WMS as usual, without noticing the difference.

When not to activate it?

There are times when this optimization becomes a hindrance:

  • If you use dynamic parameters in your queries (e.g. CQL_FILTER, viewparams, or other client-side filters), the cache can’t anticipate them.
  • If the layer is updated very frequently, and you need up-to-date data for every query, the cache becomes a liability.
  • If you need to disable caching for specific users or contexts.

To summarize

Test performance with and without this option, depending on your use cases. On stable bases, this simple checkbox can revolutionize the response times of your WMS services.

Option enabled Option disabled
WMS runs through GWC WMS cache runs through GeoServer
Faster More flexible
For stable layers For dynamic data

Test performance with and without this option, depending on your use cases. On stable bases, this simple checkbox can revolutionize the response times of your WMS services.

2-Explicitly require use of TILED parameter

In advanced GeoServer configurations, there’s an often overlooked but very useful option: “Explicitly require the use of the TILED parameter”. This allows more precise control over when GeoWebCache (GWC) should intervene to provide pre-generated tiles in WMS responses. Here’s why (and how) to use it effectively.

The problem: tiles or dynamic image?

Some client applications (such as QGIS, OpenLayers or custom viewers) perform WMS queries in the traditional way, without the TILED=true parameter. In this case, GeoServer hesitates: should it serve a dynamic image generated on the fly, or return a tile from the cache already available?

This can lead to :

  • Display inconsistencies (mixed styles, inaccurate zoom levels),
  • Performance problems if the dynamic image is unnecessarily calculated,
  • Unexpected visual results, especially when superimposed with other layers.

The solution: force explicit use of TILED=truee

By checking this option in your layer configuration in GeoServer :

  • GeoServer will only use GeoWebCache if the request contains TILED=true.
  • Otherwise, it will generate a standard WMS image on the fly, as if the cache didn’t exist.

This ensures :

  • Greater visual consistency: no mixing of tiled and dynamic raster rendering.
  • Better client control: only clients who know how to handle tiles receive tiles.
  • More predictable server-side logic.

When to use this option?

Use it if… Avoid it if…
You have a cache in production but a variety of WMS clients (some without TILED=true) You want to maximize performance without worrying about TILED=true
You’ve observed rendering bugs linked to raster/tile mixing All your clients use the cache with TILED=true
You need to keep classic WMS rendering for certain dynamic uses You prioritize performance over flexibility.

In a nutshell

Enabling “Requires TILED=true” in GeoServer means choosing clarity and control over “all automatic”. This is a very useful option in mixed environments, where not all clients have the same level of sophistication in tile cache management.

3-Enable the WMS-C service

GeoServer offers several ways of distributing maps over the web. One of the most powerful is the WMS-C service (Web Map Service – Cached). This is an extension of the classic WMS, which uses GeoWebCache to rapidly distribute pre-generated tiles. The result: faster rendering, less server load and a better user experience.

WMS-C benefits

  • Speed: as tiles are already generated, the map is displayed immediately.
  • Multi-level optimization: Each zoom level is pre-calculated.
  • Resource savings: less load on GeoServer’s WMS engine.

How does it work?

Classic WMS request ::

/geoserver/ows?service=WMS&request=GetMap&layers=layer_name...

WMS-C request with cache :

/geoserver/gwc/service/wms?service=WMS&request=GetMap&layers=layer_name…&TILED=true

It’s the TILED=true parameter and the GWC URL that trigger the use of tiles.

When to activate WMS-C?

  • If you use tile-compatible clients (Leaflet, OpenLayers, etc.).
  • If you have activated GeoWebCache.
  • To improve performance on minimally modified layers.
  • If you use tile-compatible clients (Leaflet, OpenLayers, etc.).
  • If you have activated GeoWebCache.
  • To improve performance on minimally modified layers.

What about “direct WMS integration”?

On the surface, “Enable direct WMS integration” and “Enable WMS-C service” may seem redundant, but they have very distinct roles in GeoWebCache.

OptionRoleWhen to use it? Enable direct WMS integrationGeoWebCache intercepts classic WMS requests (GetMap) and serves them via the cache, even if they are not explicit.if you want to speed up your existing WMS services without modifying the clients.Enable WMS-C serviceActive a separate WMS-C service, which requires explicit requests with TILED=true.if you’re using a GIS client that supports WMS-C and sends the right requests.

Option Role When to use it?
Enable direct WMS integration GeoWebCache intercepts classic WMS requests (GetMap) and serves them via the cache, even if they are not explicit. if you want to speed up your existing WMS services without modifying the clients
Enable WMS-C service Active a separate WMS-C service, which requires explicit requests with TILED=true. if you’re using a GIS client that supports WMS-C and sends the right requests.

In a nutshell:

  • Direct WMS integration is transparent to customers.
  • WMS-C is useful if you want to control customer-side queries.

For optimum performance, consider activating both options if your use cases allow. This ensures compatibility with recent GIS clients while taking advantage of the existing client-side cache without change.

4-Enable the TMS service

TMS (Tile Map Service) is a raster tiling protocol widely used for map distribution in client applications such as OpenLayers, Leaflet and other map viewers. It allows you to divide a raster image into smaller tiles for fast, fluid viewing, particularly useful for web applications. If you use GeoServer to manage your geospatial data, activating this TMS service enables you to make your tiles available for such applications.

What is the TMS service?

The TMS service is based on a simple protocol that defines how tiles should be organized and accessed via a structured URL. For example, a TMS request on GeoServer might look like this:

http://localhost:8080/geoserver/gwc/service/tms/1.0.0/{workspace}:{layer}@EPSG:4326@png/{z}/{x}/{y}.png

Here, the variables {workspace}, {layer}, {z}, {x}, and {y} respectively represent the workspace, the data layer, and the tile coordinates at different levels of zoom (z), longitude (x), and latitude (y). This type of request is generally used to load raster tiles (often in PNG format) from a cache generated via GeoWebCache, a GeoServer extension that enables efficient tile management.

Why activate the TMS service?

There are several reasons why you might want to enable the TMS service in your GeoServer instance:

  1. To serve tiles to a TMS-compatible web application: If you’re using a library like OpenLayers or Leaflet, which supports the TMS protocol, enabling this service simplifies map integration and display.
  2. A simpler service than WMTS: Unlike WMTS (Web Map Tile Service), which requires a certain amount of formalism (such as defining the map structure in a GetCapabilities file and managing layers), the TMS service is much simpler to configure and use. You don’t need to specify complex information; a simple HTTP request is all you need.
  3. Using GeoWebCache for tile caching: If you’ve already generated a tile cache via GeoWebCache, enabling the TMS service lets you make this cache accessible via the TMS protocol, optimizing display performance.

When to activate TMS?

Activating the TMS service can make sense in several specific cases:

  • If you want to distribute tiles to web applications using TMS: This is ideal if you work with simple map viewers like OpenLayers, which accept this tile format.
  • When you prefer a lighter, faster solution: If your aim is to simplify the mapping service without the complexity of WMTS specifications, TMS is the ideal solution.
  • If you’ve already generated a cache via GeoWebCache: If you’ve taken the time to create a tile cache, activating the TMS service will enable you to leverage this cache and make it easily accessible.

The difference between TMS, WMTS and WMS-C

TMS, WMTS and WMS-C (Web Map Service-Cached) are all methods of distributing maps in tile form, but each has its own specific features:

  • TMS: This is a simple solution for distributing tiles via a well-structured URL. It is mainly used with libraries such as OpenLayers and Leaflet. TMS is more flexible but less formal than WMTS. It does not require a complex specification file like WMTS, which can simplify its use for smaller or less complex projects.
  • WMTS: Unlike TMS, WMTS is a more structured standard that precisely defines tiles and their organization. It requires a GetCapabilities file to describe map structure, formats and available resolutions. WMTS is ideal for applications where a more robust, standards-compliant service is required.
  • WMS-C: This is the cached version of the Web Map Service (WMS). Although it offers dynamic map rendering, WMS-C can serve cached images in response to requests, like TMS. However, unlike TMS, it remains based on the WMS protocol, which can be more cumbersome in terms of managing requests and rendering.

Enabling the TMS service on GeoServer is a practical solution for users wishing to easily integrate raster tiles into their web applications using protocols such as OpenLayers or Leaflet. It’s particularly useful if you’re looking for a fast, lightweight solution, or if you’ve already set up a tile cache with GeoWebCache. Compared with WMTS and WMS-C, the TMS service offers greater flexibility and simplified configuration, ideal for less complex projects.

5-Enable data security

Data security is a crucial aspect of any geospatial application. In GeoServer, particularly from version 2.26 onwards, the “Enable data security” option in the GeoWebCache settings enables you to reinforce the protection of cached tiles by applying security filters based on user authorizations. This ensures that only authorized persons can access certain geospatial data, even if it has been cached for quick access.

What exactly does this option do?

When enabled, this option enables GeoWebCache to respect the security rules defined in GeoServer. In concrete terms, this means :

  1. Respect layer security rules: GeoWebCache will apply the layer security rules configured in GeoServer. For example, if a layer has access restrictions based on roles or groups, GeoWebCache will only send tiles to users authorized to view that layer.
  2. Filtering of cached tiles: GeoWebCache will only serve cached tiles to users with the necessary rights to access the corresponding layer. So even if tiles have been generated for a layer, they will not be available to unauthorized users.

Why is this option important?

By default, without this security enabled, tiles generated by GeoWebCache are accessible to anyone, which can pose confidentiality problems. For example, an unauthorized user could guess the URL of a tile and access it, thus bypassing the restrictions applied at GeoServer level.

By activating the “Enable data security” option, you gain several key benefits:

  • Protection of sensitive data: You prevent sensitive or restricted information from being accessed via cached tiles. This prevents, for example, an unauthorized user from guessing the URL of a tile and viewing it despite the layer restrictions in GeoServer.
  • Respect for WMS/WFS permissions: By enabling this security feature, you ensure that the permissions defined via GeoServer’s Security Manager (groups, roles, etc.) are respected. This ensures that only people with the appropriate rights can view tiles on protected layers.

In a nutshell

The “Enable data security” option in GeoWebCache is an essential feature for ensuring that cached tiles cannot be accessed by unauthorized users. It protects sensitive data by respecting the security settings defined in GeoServer and ensuring that only those with the right authorizations can access the tiles. This adds an important layer of security, especially when sensitive geospatial data is made available on the web.

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *