Files
openlayers/examples/wmts-capabilities.js
Bruno Binet 48e142d3f0 Fix wmts-capabilities example
the parsing of the wmts getCapabilities document require proj4js.

Also initialize common ol3 projections with ol.projection.addCommonProjections
so that it won't try to get EPSG:3857 from proj4js.
2013-03-20 14:39:14 +01:00

27 lines
782 B
JavaScript

goog.require('ol.parser.ogc.WMTSCapabilities');
goog.require('ol.projection.addCommonProjections');
ol.projection.addCommonProjections();
Proj4js.defs['EPSG:31256'] = '+proj=tmerc +lat_0=0 ' +
'+lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel ' +
'+towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 ' +
'+units=m +no_defs';
var parser = new ol.parser.ogc.WMTSCapabilities(), result;
var url = 'data/WMTSCapabilities.xml';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
/**
* onload handler for the XHR request.
*/
xhr.onload = function() {
if (xhr.status == 200) {
result = parser.read(xhr.responseXML);
document.getElementById('log').innerHTML =
window.JSON.stringify(result, undefined, 2);
}
};
xhr.send();