[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"
template="http://testhost/mapproxy/map/wmts/lufo50cm/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.jpeg"/>
?
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
reads:
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:
http://testhost/mapproxy/map/wmts/1.0.0/lufo50cm/lufo50cm/nlgrid/03/4/4.jpg
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ows/1.1
http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"
version="1.0.0" xml:lang="en">
<ows:Exception exceptionCode="InvalidParameterValue">
<ows:ExceptionText>
invalid format (jpg). this tile set only supports (jpeg)
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
If I manually change the extension to ".jpeg", the expected tile is
displayed correctly.
http://testhost/mapproxy/map/wmts/1.0.0/lufo50cm/lufo50cm/nlgrid/03/4/4.jpeg
=> correct tile
I tried fiddling with the "caches" definition file map.yaml
caches:
lufo50cm_cache:
grids: [nlgrid]
sources: [lufo50cm_wms]
format: image/jpeg
image:
resampling_method: nearest
If I change "format" to "image/jpg", MapProxy wmts fails on both .jpg en
.jpeg requests.
Thanks,
Anne Blankert
More information about the MapProxy
mailing list