GeoSpatial Techno is a startup focused on geospatial information that is providing e-learning courses to enhance the knowledge of geospatial information users, students, and other startups. The main approach of this startup is providing quality, valid specialized training in the field of geospatial information.

( YouTube | LinkedIn | Facebook | X )


How to create Tile Layers with GeoServer

In this session, we will explore “How to create Tile Layers with GeoServer”. If you want to access the complete tutorial, simply click on the link.

Introduction

GeoWebCache is a tiling server that acts as a proxy between a map client and map server, caching tiles to save processing time. It is integrated with GeoServer and can significantly improve the responsiveness and reliability of the server. These settings can be accessed from the left side of the screen under the Tile Caching heading. They include:

  • Tile Layers: This section lists all cached layers for review and parameter modification.
  • Caching Defaults: Caching Defaults is the entry point for these.
  • Gridsets: This option allows you to create new tiling schemes or modify the existing ones.
  • Disk Quota: The Disk Quota and BlobStores options allow you to set predefined amounts of disk space for each layer.

Tile Layers

The tile layers menu shows a listing of all of the layers known to the integrated GeoWebCache. It is similar to the Layer Preview for GeoWebCache, with many of the same options that you can review the status and the main parameters for each layer. For each layer cached by GeoWebCache, the following information is available:

  • Type and Layer Name: These columns display the type of layer and the name value of each.
  • Disk Quota: The maximum amount of disk space that can be used for this layer. This feature cannot be configured in GeoServer as in the GeoWebCache standalone version, so you can only see the N/A value here.
  • Disk Used: The current disk space being used by tiles for this particular layer. This counter will only be updated if disk quotas are enabled.
  • Enabled: Indicates whether tile caching is enabled for this layer. It is possible to have a layer definition here but not to have tile caching enabled (set in the layer properties).
  • Preview: Similar to Layer Preview, this will generate a simple OpenLayers application populated with tiles from one of the available gridset/image format combinations.
  • Actions: Actions have two options, Seed/Truncate and Empty link.
  • Seed/Truncate: Opens the GeoWebCache page for automatically seeding and truncating the tile cache. Use this if you want to pre-populate some of your cache.
  • Empty: This removes all saved tiles from the cache and is identical to a full truncate operation for the layer.
  • Empty All: This link lets you clear the entire cache for all layers, gridsets and filter parameter combinations. Note that, This will truncate all layers in GeoWebCache.

Adding or removing cached layers

We have used the GeoWebCache to store tiles generated by user requests, but you can also precompute tiles for a layer to avoid delays for some users. The process of pre-computing tiles is called seeding. This section will help you understand how it works:

  • Navigate to the Tile Caching > Tile Layers page and click on the Seed/Truncate link for your desired layer.
  • Scroll to the Create a new task section and set the parameters for seeding. For the number of parallel processes (threads) that will request maps from GeoServer, it’s best to select a number of threads equal to “50” percent of the available cores on your server.
  • From the Operation Type you have a few options: Seed, Reseed and Truncate. Select Seed to generate missing tiles or Reseed to regenerate all tiles. Truncate allows you to select specific zoom levels to remove, unlike the Clear operation, which removes all tiles.
  • You must select a gridset and an image format to seed. If you want to precompute cache for more than one gridset and/or image format, you can start another operation immediately after this one.
  • To start seeding, select a subset of the gridset, specify a level range and an area. If no specific area is needed, leave the Bounding Box empty. Select Zoom Start and Zoom Stop, then press Submit to start seeding.
  • The web interface displays a list of running tasks, which can be filtered by layer and stopped if necessary. Refreshing the list shows the number of tiles completed, time elapsed, and time remaining. Seeding multiple layers can be resource intensive and time consuming.
  • When tasks are completed, check for an empty list. Return to the Tile Layers page to see a significant increase in the amount of disk space allocated for your layer’s tiles. Seeding your layers can greatly improve performance, as map requests will now hit the cache in the precomputed layer range. Expect a 10- to 90-fold increase in performance.

Tiles can be generated by GeoWebCache in two ways: on-demand during map viewing, or by seeding in advance. On-demand caching speeds up subsequent views, but reduces the quality of the user experience. Seeding improves the user experience but is time and disk consuming. Typically, a combination of both methods is used, with popular areas or zoom levels seeded and less frequently viewed tiles left uncached.

Disk Quota

The Disk Quotas page lets you manage disk usage for cached tiles and set a global disk quota. By default, disk usage for cached tiles is unlimited, but setting a quota can prevent disk capacity issues, especially with Direct WMS integration. This is important for serving large areas with terabytes of tile cache on disk. The following information is displayed on the Disk Quota page:

  • Enable disk quota: When enabled, the disk quota will be set according to the options listed below. The setting is disabled by default.
  • Disk quota check frequency: This setting determines how often the cache is polled for any overage. Smaller values (more frequent polling) will slightly increase disk activity, but larger values (less frequent polling) may cause the disk quota to be temporarily exceeded. The default is 10 seconds.
  • Maximum tile cache size: The maximum size for the cache. When this value is exceeded and the cache is polled, tiles will be removed according to the policy. Note that the unit options are MegaBytes, GigaBytes and TeraBytes. The default is 500 MiB.
  • Tile removal policy: When disk quota is exceeded, choose between Least Frequently Used or Least Recently Used policy to delete tiles based on access frequency or date last accessed. Optimal configuration varies based on data and server usage.
  • Disk quota store type: GeoServer uses the H2 database for disk quotas by default, with the option to configure an external database. You can choose an in-process database with a local H2 database or an external database with H2, PostgreSQL or Oracle. Don’t forget to press Submit after making changes.

In this session, we explored “How to create Tile Layers with GeoServer”. If you want to access the complete tutorial, simply click on the link.