let terLayer = new ol.layer.Tile({
crossOrigin: 'anonymous',
visible: true,
source: new ol.source.TileSuperMapRest({
url: this.mapServerUrl + "/map-tianditu/rest/maps/地形底图_经纬度",
transparent: true
}),
projection: 'EPSG:4326',
});
document.querySelectorAll('.ol-viewport canvas'),
function (canvas) {
if (canvas.width > 0) {
var opacity = canvas.parentNode.style.opacity;
mapContext.globalAlpha = opacity === '' ? 1 : Number(opacity);
// var transform = canvas.style.transform;
// Get the transform parameters from the style's transform matrix
/*var matrix = transform
.match(/^matrix\(([^\(]*)\)$/)[1]
.split(',')
.map(Number);*/
// Apply the transform to the export map context
CanvasRenderingContext2D.prototype.setTransform.apply(
mapContext,
[1, 0, 0, 1, 0, 0]
);
mapContext.drawImage(canvas, 0, 0);
}
}