adds TileMatrixSetLimits to WMTS format reader

enhance wmtstilegrid to use it when building matrixId and resolution arrays
This commit is contained in:
Thomas Tilak
2016-07-18 17:55:21 +02:00
parent fd3c9f58bf
commit 1f04a0aad9
6 changed files with 725 additions and 18 deletions
@@ -115,4 +115,78 @@ describe('ol.format.WMTSCapabilities', function() {
});
});
describe('when parsing ign.xml', function() {
var parser = new ol.format.WMTSCapabilities();
var capabilities;
before(function(done) {
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
try {
capabilities = parser.read(xml);
} catch (e) {
done(e);
}
done();
});
});
it('can read Capability.Contents.Layer', function() {
expect(capabilities.Contents.Layer).to.be.an('array');
expect(capabilities.Contents.Layer).to.have.length(1);
var layer = capabilities.Contents.Layer[0];
expect(layer.TileMatrixSetLink).to.be.an('array');
expect(layer.TileMatrixSetLink).to.have.length(1);
expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be
.eql('PM');
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.be.an('array');
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.have.length(20);
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].TileMatrix)
.to.be.eql('0');
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileRow)
.to.be.eql(0);
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileRow)
.to.be.eql(1);
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileCol)
.to.be.eql(0);
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileCol)
.to.be.eql(1);
});
it('Can read Capabilities.Content.TileMatrixSet', function() {
expect(capabilities.Contents.TileMatrixSet).to.be.ok();
var pm = capabilities.Contents.TileMatrixSet[0];
expect(pm).to.be.ok();
expect(pm.Identifier).to.be.eql('PM');
expect(pm.SupportedCRS).to.be.eql('EPSG:3857');
expect(pm.TileMatrix).to.have.length(22);
expect(pm.TileMatrix[0].Identifier).to.be.eql('0');
expect(pm.TileMatrix[0].MatrixHeight).to.be.eql(1);
expect(pm.TileMatrix[0].MatrixWidth).to.be.eql(1);
expect(pm.TileMatrix[0].ScaleDenominator)
.to.be.eql(559082264.0287178958533332);
expect(pm.TileMatrix[0].TileWidth).to.be.eql(256);
expect(pm.TileMatrix[0].TileHeight).to.be.eql(256);
expect(pm.TileMatrix[0].TopLeftCorner).to.be.a('array');
expect(pm.TileMatrix[0].TopLeftCorner[0]).to.be.eql(-20037508);
expect(pm.TileMatrix[0].TopLeftCorner[1]).to.be.eql(20037508);
expect(pm.TileMatrix[1].Identifier).to.be.eql('1');
expect(pm.TileMatrix[1].MatrixHeight).to.be.eql(2);
expect(pm.TileMatrix[1].MatrixWidth).to.be.eql(2);
expect(pm.TileMatrix[1].ScaleDenominator)
.to.be.eql(279541132.0143588959472254);
expect(pm.TileMatrix[1].TileWidth).to.be.eql(256);
expect(pm.TileMatrix[1].TileHeight).to.be.eql(256);
expect(pm.TileMatrix[1].TopLeftCorner).to.be.a('array');
expect(pm.TileMatrix[1].TopLeftCorner[0]).to.be.eql(-20037508);
expect(pm.TileMatrix[1].TopLeftCorner[1]).to.be.eql(20037508);
});
});
});