Skip to main content

Cesium ion Adds WMTS Support

Washington D.C. 3 inch (0.8 meter) imagery streaming from Cesium ion into OpenLayers.

From the beginning CesiumJS has supported open formats to promote interoperability. Cesium ion takes the same open approach to serving 3D geospatial content, which allows it to provide content to apps built with CesiumJS, osgEarth, OpenLayers, and others.

To support even more visualization engines, Cesium ion recently expanded its imagery support from TMS to also include WMTS.

Here is a basic example of how to load WMTS in OpenLayers. This snippet will load and parse a WMTS capabilities file and create a WMTS layer from it.

async function createMap() {
    var parser = new ol.format.WMTSCapabilities();
    var response = await fetch(assetUrl + 'WMTSCapabilities.xml');
    var text = await response.text();
    var result = parser.read(text);

    // ion capabilities only support Mercator with a single default layer
    var options = ol.source.WMTS.optionsFromCapabilities(result, {
        layer: 'default',
        matrixSet: 'EPSG:3857'
    });

    // Create the map with a single WMTS layer
    var map = new ol.Map({
        layers: [
            new ol.layer.Tile({
                opacity: 1,
                source: new ol.source.WMTS(options)
            })
        ],
        target: 'map'
    });
});

createMap();

To view a full working demo of loading WMTS from Cesium ion in OpenLayers, with source code, check out this example.

How are you using Cesium ion’s imagery?