[MapProxy] WMTS: invalid format (jpg != jpeg)

Anne Blankert anne.blankert at geodan.nl
Fri Mar 15 02:42:08 PDT 2013

Hello list,

Is a WMTS jpeg standard request required to  use .jpeg extension instead 
of .jpg extension?
Is a request required to exactly follow the template as given in the 
WMTS GetCapabilities:
<ResourceURL format="image/jpeg" resourceType="tile"

I have set up a format image/jpeg only WMTS through MapProxy 1.5 and it 
works well with the MapProxy supplied OpenLayers demo javascript which 

var layer = new OpenLayers.Layer.WMTS({
      name: "WMTS aerial photo",
      url: '../wmts/lufo50cm',
      getURL: tileUrl,
      layer: 'lufo50cm',
      matrixSet: 'nlgrid',
      format: 'image/png',
      isBaseLayer: true,
      style: 'default',
      requestEncoding: 'REST'

function tileUrl(bounds) {
      var tileInfo = this.getTileInfo(bounds.getCenterLonLat());
      return this.url + '/' + this.matrixSet + '/' + 
this.matrix.identifier + '/' +
tileInfo.col + '/' + tileInfo.row + '.jpeg';

In the above javascript the OpenLayers getURL property points to 
function 'tileUrl' that adds the "jpeg" extension to the request.

However, if I use a modified wmts example from OpenLayers 
(http://openlayers.org/dev/examples/wmts.js) as follows:

var wmts = new OpenLayers.Layer.WMTS({
         name: "WMTS aerial photo",
         /*url: "http://testhost/mapproxy/map/service",*/ /* KVP */
         url: "http://testhost/mapproxy/map/wmts", /* REST */
         layer: "lufo50cm",
         matrixSet: "nlgrid",
         matrixIds: matrixIds,
         format: "image/jpeg",
         requestEncoding: "REST", /* default "KVP" */
         style: "lufo50cm",
         opacity: 0.7,
         isBaseLayer: false

This results in pink tiles saying: "invalid format (jpg). this tile set 
only supports (jpeg)"

Example request and response:

<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" 
version="1.0.0" xml:lang="en">
<ows:Exception exceptionCode="InvalidParameterValue">
invalid format (jpg). this tile set only supports (jpeg)

If I manually change the extension to ".jpeg", the expected tile  is 
displayed correctly.
=> correct tile

I tried fiddling with the "caches" definition file map.yaml
     grids: [nlgrid]
     sources: [lufo50cm_wms]
     format: image/jpeg
       resampling_method: nearest

If I change "format" to "image/jpg", MapProxy wmts fails on both .jpg en 
.jpeg requests.


Anne Blankert

More information about the MapProxy mailing list