结合projzh,可无偏移加载百度地图
ol.layer.Bmap = function (options) {
var options = options ? options : {};
this.layers = []
var type = options.type, label = options.label;
var opacity = options.opacity ? options.opacity : 1;
var baiduMercator = new ol.proj.Projection({
code: 'bd09',
extent: ol.extent.applyTransform(this.extent, projzh.ll2bmerc),
units: 'm'
});
ol.proj.addProjection(baiduMercator);
ol.proj.addCoordinateTransforms('EPSG:4326', baiduMercator, projzh.ll2bmerc, projzh.bmerc2ll);
ol.proj.addCoordinateTransforms('EPSG:3857', baiduMercator, projzh.smerc2bmerc, projzh.bmerc2smerc);
this.layers.push(this.crtLayerXYZ(type, opacity));
if (label && type === "img") {
this.layers.push(this.crtLayerXYZ("cia", opacity));
}
}
ol.layer.Bmap.prototype.layers = []
ol.layer.Bmap.prototype.extent = [-179.9, -90, 179.9, 90]
ol.layer.Bmap.prototype.b