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

Oliver Tonnhofer olt at omniscale.de
Fri Mar 15 05:00:15 PDT 2013

Hi Anne,

On 15.03.2013, at 10:42, Anne Blankert wrote:
> 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"
> template="http://testhost/mapproxy/map/wmts/lufo50cm/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.jpeg"/>

Yes, you need to follow the ResourceURL template for WMTS RESTful requests.

> [...]
> 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:
> http://testhost/mapproxy/map/wmts/1.0.0/lufo50cm/lufo50cm/nlgrid/03/4/4.jpg

The "right way" is to parse the WMTS capabilities, since a service might even have a template with complete different order of the parameters.

I just noticed that OpenLayers supports URL templates as the `url` parameter since November 2011[1]. So you should be able to use that without creating a custom getTile function. I think this will be a good reason to update the OpenLayers library in the MapProxy demo service for 1.6.

[1] https://github.com/openlayers/openlayers/commit/3752b0572d0f164606f14ae73e70475b8013900e


Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.com
http://mapproxy.org | https://github.com/olt    | @oltonn

More information about the MapProxy mailing list