[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
- Why doesn't WMTS respect the VIEWPARAMS like WMS and WFS do?
- Do I need special configuration for WMTS to work with parameterized SQL Views?
- Is there a way to set up GeoWebCache to properly handle SQL View parameters?
- Are there any known limitations with WMTS and parameterized views?
-
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.Vince– Vince2025年04月04日 13:46:39 +00:00Commented Apr 4 at 13:46
1 Answer 1
Explore related questions
See similar questions with these tags.