[OpenLayers-Users] Issue with WMTS layer created with WMTSGetCapabilities

Stephen Woodbridge woodbri at swoodbridge.com
Mon Mar 28 12:37:02 EDT 2011


On 3/27/2011 7:48 PM, Stephen Woodbridge wrote:
> OK, seems to be my weekend for problems :)
>
> I am trying to get WMTS layer to be created from the WMTSGetCapabilities
> document. It seems to be reading the document ok and creating the layer
> but the layers does not work correctly.
>
> Here is the getCapabilities document:
>
> http://imaptools.com:8080/geocache/wmts?service=wmts&request=getcapabilities
>
>
> Here is a simple web page I'm using for testing:
>
> http://imaptools.com:8080/gc4.html
>
> This has 3 layers defined:
>
> 1. WMTS in spherical mercator explicitly defining all the parameters.
> This layer works fine as far as I can tell. It is for reference and to
> show that the service is up and running correctly.
>
> 2. This attempts to read the getCapabilites document and create a layer
> identical to the above based on the document. It seems that this layer
> is in WGS84, degrees, and resolutions, etc if I inspect the
> map.layer[1].* properties, instead of the values from the requested
> matrixSet.
>
> 3. This attempts to read the getCapabilites document and create a layer
> that is WGS84 based on the document, and I figured it had at least some
> chance of working given the defaults found in 2. And map.zoom==1, shows
> two broken tiles with TILEROW=-1
>
> So, I'm hoping that someone that knows about about WMTS can take a peak.
> I'm digging through the code, but have not had much luck discovering
> anything helpful.

As a follow up on this post, it seems that 
OpenLayers.Format.WMTSCapabilities() is not creating a appropriate layer 
definition from the getCapabilities document.

In OpenLayers.Format.WMTSCapabilities:148 we have:

             layer = new OpenLayers.Layer.WMTS(
                 OpenLayers.Util.applyDefaults(config, {
                     url: 
capabilities.operationsMetadata.GetTile.dcp.http.get,
                     name: layerDef.title,
                     style: style,
                     matrixIds: matrixSet.matrixIds
                 })
             );

This is not setting:

layer.resolutions[]
layer.projection
layer.units
layer.maxExtents

from the capabilities document information so these are defaulting to 
EPSG:4326 values that are not valid for sphericalMercator layers.

Another possible conclusion is that the OpenLayers.Layer.WMTS() 
constructor is not populating these items from the matrixIds if all the 
information is in there.

Yes, I know that I can set these items manually via the "config" 
argument, but this seems to defeat the whole purpose of defining the 
layer via the capabilities document in the first place.

Am I sizing this up correctly? Or maybe I have missed something.

Thanks,
   -Steve


More information about the Users mailing list