Expert GeoServer
eBook - ePub

Expert GeoServer

Build and secure advanced interfaces and interactive maps

  1. 134 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Expert GeoServer

Build and secure advanced interfaces and interactive maps

Book details
Book preview
Table of contents
Citations

About This Book

A fast-paced guide to putting your GeoServer-based application into fast, user-friendly, and secure production

Key Features

  • Resolve bottlenecks, optimize data stores, and cluster server resources
  • Use identity management and authentication for a user-specific, secure web application
  • Go beyond traditional web hosting to explore the full range of hosting options in the cloud

Book Description

GeoServer is open source, server-side software written in Java that allows users to share and edit geospatial data. In this book, you'll start by learning how to develop a spatial analysis platform with web processing services. Then you'll see how to develop an algorithm by chaining together geospatial analysis processes, which you can share with anyone in the world.

Next you'll delve into a very important technique to improve the speed of your map application—tile caching. Here, you'll understand how tile caching works, how to develop an effective tile cache-supported web service, and how to leverage tile caching in your OpenLayers web application.

Further on, you'll explore important tweaks to produce a performant GeoServer-backed web mapping application. Moving on, you'll enable authentication on the frontend and backend to protect sensitive map data, and deliver sensitive data to your end user. Finally, you'll see how to put your web application into production in a secure and user-friendly way. You'll go beyond traditional web hosting to explore the full range of hosting options in the cloud, and maintain a reliable server instance.

What you will learn

  • Develop a WPS-processing service to allow web-based geospatial data processing
  • Get to know important techniques to improve the speed of your web map application—tile caching, raster data optimization, and server clustering
  • Find out which GeoServer settings resolve bottlenecks
  • Develop an algorithm by chaining geospatial analysis processes together
  • Put your application into production with hosting, monitoring, and automated backup and recovery
  • Understand how to develop an effective tile cache-supported web service
  • Master techniques that ensure resilient server deployment

Who this book is for

This book is for anyone who wants to learn about advanced interfaces, security, and troubleshooting techniques in GeoServer. A basic understanding of GeoServer is required

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Expert GeoServer by Ben Mearns in PDF and/or ePUB format, as well as other popular books in Informatik & Informatik Allgemein. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781789535983

Speed Up Your App with Tile Caching

In this chapter, we will use tiles, pre-rendered portions of a map, to allow your app to load more rapidly. While the subject of tile caching can get pretty complex, I'll be covering the material you need to know to get your tile cache up and running and fix any issues that may occur.
First, we'll cover the tile caching basics. Then, you'll learn how to configure tile caching and GeoServer. Next, you'll create a tile-backed web map app, you'll learn to use the tile cache, and finally we'll explore methods for solving problems with tile caching.
In this chapter, we will cover the following topics:
  • Tile caching basics
  • Configure tile caching in GeoServer
  • Creating a tile-backed OL app
  • Using the tile cache
  • Resolving problems with tile caching

Tile caching basics

In this section, you'll learn key concepts for tile caching, including tile caching schemes. We'll look at some software options for tile caching, and finally you'll learn about the process associated with the GeoServer tile caching stack that we'll be using in this section.
Tile caching is very useful when you are working with background maps, or for static content that does not change very often or involve much interaction. An example of tile caching is OpenStreetMap (https://www.openstreetmap.org/#map=10/21.2516/86.7343), and you can see tile caching at work as we zoom in and out of the map; portions of the map are pre-rendered as tiles, little images, and then they're stitched together by the frontend OpenLayers client, as shown in the following screenshot:
This allows very complex cartography to be delivered very quickly to our browser, avoiding the need to render that information in the browser or on the server in real time. Here, you can see two major title caching schemes in GeoServer (WMS-C service and TMS service), which are shown in the following screenshot:
Tile caching schemes use different ways to refer to tiles and allow web clients to communicate with servers such as GeoServer to retrieve tiles in the appropriate way. While WMS-C is used for geographic coordinate bounding boxes to identify tiles, the new schemes, TMS and WMS-T, used coordinates based on the tile scheme itself, each tile numbered by its place on a grid, which is defined by variable grader origins. We can disable all of these other tile caching schemes as we are going to be using WMS-C, which is enabled separately, in its own section under Services.
The following example illustrates tile-based coordinates (https://openlayers.org/en/latest/examples/canvas-tiles.html):
So, instead of seeing the typical latitude/longitude coordinates that you would be used to, you can see coordinates based on their place within the tile grid.
It's important to think about tile caches in terms of fixed parameters. Although there is some wiggle room for allowing the client to select variable parameters, you will get the best results by sticking to minimal parameters that fit your use case.
For example, in the case of image formats, select JPEG if compression is desired – this is a great option for imagery – and PNG if using vector data. Select PNG 8 if 256 colors are adequate, and simply PNG if a wider color palette is necessary; PNG 8 uses eight bits.
There are a number of software options for tile caching with your map app; these include GDAL or GDAL, the popular command-line geospatial utility Mapnik, which is the backend for the map box project and others, and GeoWebCache. GeoWebCache is available as a standalone instance, but is also embedded in GeoServer, so we will focus on GeoWebCache. Unlike file-based tile caches running on HTTP servers, GeoServer via GeoWebCache provides web service endpoints for map tiles for static and dynamic tile caching and additional capabilities.
The following diagram explains how tile caching works with GeoServer:
On the Browser side, we have a map client such as OpenLayers, and in the OpenLayers source there's a WMST class – our WMTS class that we can use for WMTS-type tile cache schemes. There are other classes available for other schemes. The OpenLayers app first checks on the browser cache to see if a tile is already available for the tile that's needed in the map view. Note that this max age of the Image File can be set in GeoServer to limit the caching of tiles. This is especially useful for debugging purposes.
On the Geoserver side, when a tile is not found in the cache, contact will be made with the GeoServer endpoint for that layer, which refers to GeoWebCache. It can directly refer to the GeoWebCache endpoint or to the WMS endpoint with a tiled parameter. We'll be using the direct GeoWebCache endpoint. When contact is made with the GeoWebCache endpoint, GeoWebCache will check on the filesystem to see if that image tile has already been created, and if so, that tile will be served back to the browser as a response to the HTTP request. If that tile is not already available, GeoWebCache will dynamically render that tile.
In this section, you learned the basics of tile caching. In the next section, you'll learn how to configure tile caching in GeoServer.

Configuring tile caching in GeoServer

In the last section, you learned the fundamentals of tile caching. In this section, you'll learn the ins and outs of setting up tile caching in GeoServer. First, you'll learn all the global and layer options for tile caching in the GeoServer web administration interface. Then, we'll look at these settings in the XML files under the GeoServer directory. Finally, you'll learn about gridsets and why these are important in building your tile-cache-backed app.
We disabled all of these other services in the previous section, as shown in the following screenshot, since we'll be using WMST, which is enabled in the Services portion of the sidebar:
You can set a number of global options that will be available on all new layers or layer groups that will be tiled. Let's look at a couple of these options:
The metatile size and gutter size refer to ways of eliminating repeating labels or other tile artifacts that may appear during tile rendering. We'll talk more about this in the final section of this chapter.
There are a number of tile formats available; we covered this a little bit in the previous section, and we'll also cover this again in the last section of this chapter.
Another area to pay attention to here is the gridsets that are available, shown in the following screenshot, and we'll talk about those later in this section:
Formats are important for minimizing the disk space that is taken up, as well as improving the performance of GeoServer rendering and the transmission of tiles to the client app. Let's look at local options.
Options for particular layers or layer groups will also be defined on the layers themselves, or under the tile caching tab within a layer. As you can see in the following screenshot, caching is enabled for this layer:
We're using the same default on the metatile. We have both of these formats, JPEG and PNG, enabled by default. A better option here would be to have just a singl...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributors
  5. Preface
  6. Developing a Spatial Analysis Platform with WPS
  7. Speed Up Your App with Tile Caching
  8. Optimizing GeoServer
  9. Secure Authentication
  10. Putting it into Production
  11. Other Books You May Enjoy