GeoWebCache

From Wildsong
Jump to navigationJump to search

Overview

This is a story about setting up a GeoServer instance to function as a cascading tile cache.

Gag me, it's back to MapProxy

2019-Dec-05 Caveat, GeoWebCache seems to generate a plethora of errors when I try to use it with ArcGIS Portal, pushing me back to MapProxy. Again. I've already flipped between the two about 10 times now as I develop knowledge about each. Soon I will be able to list the pros and cons of the two.

The error I have been getting today on cc-testmaps is "geowebcache | 05 Dec 18:18:32 WARN [servlet.PageNotFound] - No mapping for GET /geoserver/cc-cache/wms" which is totally wrong of course. On bellman, it's something about "fast path", I should paste it in here but I am done with it for now.

On cc-testmaps, it's running out there on port 80. On Bellman it's behind a proxy, so I assume that's the cause of the error. Mind you both of these error conditions apparently affect ONLY ArcGIS products.

Back to the story now.

I want to have access to tiles that are on a remote and possibly unreliable service, so I want GeoServer to act as a proxy and pull in and cache tiles that live somewhere else.

I want to be able to seed the cache so that many of the tiles are already available at least for low zoom levels, to really speed things up.

I want to be able to group services together so that they appear as a layer group in my web map.

Docker project

I will check it into github soon as it's working and put the link here.

Basically I build off the existing wildsong/geoserver project and then set it up only as a cache. Right now it's running on port 8080, and my intention is to set up a proxy on IIS on port 443. I have to learn how to do that. :-)

Geoserver set up

The first time it's run, it has no credentials set, so log in with "admin" and "geoserver" and change them.

Create a Workspace

You have to have a workspace before you can do anything else.

  1. Under Data, Workspaces
  2. Add new workspace

Give it a concise name and a URI. Make it the default workspace (if you want to).

"Note A workspace name is a identifier describing your project. It must not exceed ten characters or contain spaces. A Namespace URI (Uniform Resource Identifier) can usually be a URL associated with your project with an added trailing identifier indicating the workspace. The Namespace URI filed does not need to resolve to an actual valid web address."

You can adjust settings for the caching by going to Tile Caching settings.

At least set the BlobStore to point at /geoserver/gwc/tmp so that the tiles will be persisted in the docker volume. Remember to enable it too.

Add a remote service

This could be whatever is supported remotely -- I've tried WMS and WMTS and WMS seems always to be smoother.

In my testing with the OregonExplorer server I found some of the services (older ones) did not work in WMS and I had to set up WMTS services.

  1. Under "Data", Store
  2. Add new store
  3. WMS - Cascades a remote Web Map Service
  4. New WMS Connection
  5. Workspace - defaults to cc-cache
  6. WMS Source Name - osip2018
  7. Description: 2018 1' orthophoto of Oregon
  8. Enabled: yes, of course
  9. Capabilities URL: Go to the remote site and click the WMS link and copy and paste the link address from the browser
  10. (leave the rest blank or defaults)
  11. Save -- Hitting "save" tests the link. If the URL is unreachable, the save operation will fail.
  12. You still have to publish it. Click on Publish
  13. Give it a title that's better than OSIP_2018_OSIP_2018_WM, like maybe "OSIP 2018"
  14. Fill in the rest of the form as you see fit.
  15. These services always happiest at EPSG:4326, leave it at that.
  16. Fill in a bounding box that corresponds to the area you want to serve. I use -124.1,45.77,-123.35,46.3

In the Layer section, you can edit the cache settings for each layer to override things like the image type (PNG, JPEG, etc) and to override the BlobStore to stash the tiles in a different place and so on...

You can turn off the "queryable" flag under Publishing settings.

Preview the service

If you did all that correctly you should now be able to preview the new layer.

  1. under Data, select Layer Preview.
  2. In the Layer Preview list, click OpenLayers for the service you just created.

This should open an OpenLayers preview and you can see the data and zoom around in it.

Once you are convinced you can preview the service in OpenLayers, you should open it in QGIS to make sure it works there, too.

Add more services

I added NAIP 2016 from OregonExplorer.

Make several of your layers into a group

  1. Data -> Layer Groups
  2. Add new layer group
  3. Fill in the form as above...

For "Mode", refer to https://docs.geoserver.org/master/en/user/data/webadmin/layergroups.html

I think I want "Named Tree" in this case.

In the GUI I can sort the order of the layers the way I want, nice.

Reference the layer group in ArcGIS Portal

Use the layer group from Portal in a map

We're done.