[OpenLayers-Trac] [OpenLayers] #3221: WMTSCapabilities.createLayer and Format.WMTS issues

OpenLayers trac-20090302 at openlayers.org
Wed Mar 30 15:55:51 EDT 2011


#3221: WMTSCapabilities.createLayer and Format.WMTS issues
---------------------+------------------------------------------------------
 Reporter:  woodbri  |       Owner:              
     Type:  bug      |      Status:  new         
 Priority:  major    |   Milestone:  2.11 Release
Component:  general  |     Version:  2.10        
 Keywords:           |       State:              
---------------------+------------------------------------------------------
 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

 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.

 And digging into this a little more, it looks like
 OpenLayers/Format/OWSCommon/v1.js does not extract the BoundingBox tags at
 all:

 {{{
             "BoundingBox": function(node, obj) {
                 // FIXME: We consider that BoundingBox is the same as
 WGS84BoundingBox
                 // LowerCorner = "min_x min_y"
                 // UpperCorner = "max_x max_y"
                 // It should normally depend on the projection
                 this.readers['ows']['WGS84BoundingBox'].apply(this, [node,
 obj]);
             },
 }}}

 According to the standard you can have zero or more of these:

 {{{
 <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::4326">
 <ows:LowerCorner>-180.000000 -90.000000</ows:LowerCorner>
 <ows:UpperCorner>180.000000 90.000000</ows:UpperCorner>
 </ows:BoundingBox>
 }}}

 mod-geocache emits one for each supported crs on a layer and each
 TileMatrixSet has a SupportedCRS tag that points back to the appropriate
 BoundingBox. So the BoundingBox tags should get extracted as an array
 either like:

 {{{
 capabilities.contents.layer[n].bounds{crs} = OpenLayers.Bounds
 }}}

 or

 {{{
 capabilities.contents.layer[n].bounds[0..n] = {
   crs: crs,
   bounds: OpenLayers.Bounds
 }
 }}}

 Then it would be possible to fix
 OpenLayers.Format.WMTSCapabilities.createLayer() to extract the
 appropriate information from the capabilities document and create a
 working layer.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3221>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list