[OpenLayers-Commits] r11142 - in trunk/openlayers: lib/OpenLayers/Format/WMTSCapabilities tests/Format/WMTSCapabilities

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Feb 18 02:14:27 EST 2011


Author: fredj
Date: 2011-02-17 23:14:27 -0800 (Thu, 17 Feb 2011)
New Revision: 11142

Modified:
   trunk/openlayers/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js
   trunk/openlayers/tests/Format/WMTSCapabilities/v1_0_0.html
Log:
save the resourceUrl elements into the WMTS capabilities object. r=bartvde (closes #2986)

Modified: trunk/openlayers/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js	2011-02-17 23:02:31 UTC (rev 11141)
+++ trunk/openlayers/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js	2011-02-18 07:14:27 UTC (rev 11142)
@@ -191,7 +191,14 @@
             },
             "MatrixHeight": function(node, obj) {
                 obj.matrixHeight = parseInt(this.getChildValue(node)); 
-            },        
+            },
+            "ResourceURL": function(node, obj) {
+                obj.resourceUrl = obj.resourceUrl || {};
+                obj.resourceUrl[node.getAttribute("resourceType")] = {
+                    format: node.getAttribute("format"),
+                    template: node.getAttribute("template")
+                };
+            },
             // not used for now, can be added in the future though
             /*"Themes": function(node, obj) {
                 obj.themes = [];

Modified: trunk/openlayers/tests/Format/WMTSCapabilities/v1_0_0.html
===================================================================
--- trunk/openlayers/tests/Format/WMTSCapabilities/v1_0_0.html	2011-02-17 23:02:31 UTC (rev 11141)
+++ trunk/openlayers/tests/Format/WMTSCapabilities/v1_0_0.html	2011-02-18 07:14:27 UTC (rev 11142)
@@ -36,7 +36,7 @@
         }
     
         function test_layers(t) {
-            t.plan(21);
+            t.plan(25);
             var xml = document.getElementById("ogcsample").firstChild.nodeValue;
             var doc = new OpenLayers.Format.XML().read(xml);
     
@@ -75,7 +75,14 @@
             t.eq(wgs84Bbox.right, 180.0, "wgs84BoudingBox right is correct");
             t.eq(wgs84Bbox.bottom, -90.0, "wgs84BoudingBox bottom is correct");
             t.eq(wgs84Bbox.top, 90.0, "wgs84BoudingBox top is correct");
-            
+
+            t.eq(layer.resourceUrl.tile.format, "image/png", "resourceUrl.tile.format is correct");
+            t.eq(layer.resourceUrl.tile.template, "http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png", 
+                 "resourceUrl.tile.template is correct");
+
+            t.eq(layer.resourceUrl.FeatureInfo.format, "application/gml+xml; version=3.1", "resourceUrl.FeatureInfo.format is correct");
+            t.eq(layer.resourceUrl.FeatureInfo.template, "http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml", 
+                 "resourceUrl.FeatureInfo.template is correct");
         }
 
         function test_tileMatrixSets(t) {
@@ -240,6 +247,10 @@
                 <ows:UpperCorner>180 90</ows:UpperCorner>
             </ows:WGS84BoundingBox>
             <ows:Identifier>coastlines</ows:Identifier>
+            <ResourceURL format="image/png" resourceType="tile"
+                         template="http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png" />
+            <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo"
+                         template="http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml" />
             <Style isDefault="true">
                 <ows:Title>Dark Blue</ows:Title>
                 <ows:Identifier>DarkBlue</ows:Identifier>



More information about the Commits mailing list