0

[QUESTION] Why doesn't GeoServer WMTS work with SQL View parameters?

My Setup

I'm using GeoServer 2.26 with a SQL View layer that works correctly with WFS and WMS, but fails with WMTS. Here's my configuration:

SQL View Definition:

SELECT 
 map_uuid AS "mapUuid", 
 geom, 
 geom_id AS "geometryId", 
 zone, 
 round(value, 2) AS "value",
 created_date AS "createdDate", 
 round(ST_Area(geom, true)::numeric, 2) AS "sqm"
FROM public.equation_pixel_map 
WHERE map_uuid = '%mapUuid%'

with defined SQL view parameters mapUuid (default value and validation regular expression)

The Problem

When I make a WMTS request with parameters, I get empty results:

http://localhost:8080/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=agri:equation_pixel_map_view&STYLE=&TILEMATRIX=EPSG:4326:0&TILEMATRIXSET=EPSG:4326&FORMAT=application/json;type=geojson&TILECOL=1&TILEROW=0&VIEWPARAMS=UUID:ee763f5a-ef5d-4119-827d-c67aa0fc6fb6

What Works

  • WMTS requests without parameters to original table returns non-empty results:
http://localhost:8080/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=agri:equation_pixel_map&STYLE=&TILEMATRIX=EPSG:4326:0&TILEMATRIXSET=EPSG:4326&FORMAT=application/json;type=geojson&TILECOL=1&TILEROW=0
  • WFS requests with the same parameter work fine:
http://localhost:8080/agri/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=agri:equation_pixel_map_view&VIEWPARAMS=mapUuid:072db89a-a031-4ab4-b173-2c59115550b0
  • WMS requests also work correctly:
http://localhost:8080/agri/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=application/json;type=geojson&LAYERS=agri:equation_pixel_map_view&STYLES=&CRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=1024&HEIGHT=512&VIEWPARAMS=mapUuid:072db89a-a031-4ab4-b173-2c59115550b0

Questions

  1. Why doesn't WMTS respect the VIEWPARAMS like WMS and WFS do?
  2. Do I need special configuration for WMTS to work with parameterized SQL Views?
  3. Is there a way to set up GeoWebCache to properly handle SQL View parameters?
  4. Are there any known limitations with WMTS and parameterized views?
Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Apr 4 at 11:57
1
  • Welcome to GIS SE. As a new user, please take the Tour, which emphasizes the importance of asking One question per Question. Adding a numbered list of questions is guaranteed to generate closure votes. Commented Apr 4 at 13:46

1 Answer 1

-1

I didn't think there was any mechanism in GeoWebCache to pass ViewParams (or other unexpected keywords) to GeoServer. However, this issue suggests that it is possible in KVP mode, see also this for details of the filter procedure.

answered Apr 4 at 12:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.