Add parser for dimension property from WMTS Capabilities.xml

- Correct parsing of dimension in ol.source.WMTS.optionsFromCapabilities
This commit is contained in:
Julien Enselme
2015-08-25 14:33:27 +02:00
parent 936118955f
commit 475504cd85
5 changed files with 51 additions and 5 deletions

View File

@@ -94,6 +94,12 @@ access interface to some TileMatrixSets</ows:Abstract>
</TileMatrixSetLink>
<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"/>
<Dimension>
<ows:Identifier>Time</ows:Identifier>
<Default>20110805</Default>
<Value>20110805</Value>
<Value>20081024</Value>
</Dimension>
</Layer>
<TileMatrixSet>
<!-- -180 85.05112878 -->

View File

@@ -29,6 +29,15 @@ describe('ol.format.WMTSCapabilities', function() {
expect(layer.Identifier).to.be.eql('BlueMarbleNextGeneration');
expect(layer.Title).to.be.eql('Blue Marble Next Generation');
expect(layer.Dimension).to.be.an('array');
expect(layer.Dimension).to.have.length(1);
expect(layer.Dimension[0]).to.be.an('object');
expect(layer.Dimension[0].Identifier).to.be.eql('Time');
expect(layer.Dimension[0].Default).to.be.eql('20110805');
expect(layer.Dimension[0].Value).to.be.an('array');
expect(layer.Dimension[0].Value).to.have.length(2);
expect(layer.Dimension[0].Value[0]).to.be.eql('20110805');
expect(layer.Format).to.be.an('array');
expect(layer.Format).to.have.length(2);
expect(layer.Format[0]).to.be.eql('image/jpeg');

View File

@@ -42,7 +42,7 @@ describe('ol.source.WMTS', function() {
expect(options.style).to.be.eql('DarkBlue');
expect(options.dimensions).to.eql({});
expect(options.dimensions).to.eql({Time: '20110805'});
});
@@ -73,7 +73,7 @@ describe('ol.source.WMTS', function() {
expect(options.style).to.be.eql('DarkBlue');
expect(options.dimensions).to.eql({});
expect(options.dimensions).to.eql({Time: '20110805'});
});