1、3857坐标系下加载google影像

var tileSize = 256;
 var resolutions = [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135, 0.2985821416974068, 0.1492910708487034, 0.0746455354243517];
            var urlstr = "google影像瓦片存放地址";
            var layer = new ol.layer.Tile({
                id: "testlayerxyz12",
                tag: null,
                zIndex: 10,
                opacity: 1,
                visible: true,
                source: new ol.source.XYZ({
                    tileSize: [256, 256],
                    tileUrlFunction: function (tileCoord, s, e) {
                        var z = tileCoord[0];
                        var x = tileCoord[1];
                        var y = tileCoord[2];
                        if (x < 0) {
                            x = (-x);
                        }
                        if (y < 0) {
                            y = (-y);
                        }
                        var re = new RegExp('\\{z\\}', 'gm');
                        var re1 = new RegExp('\\{x\\}', 'gm');
                        var re2 = new RegExp('\\{y\\}', 'gm');
                        var str = urlstr.replace(re, z);
                        str = str.replace(re1, x);
                        str = str.replace(re2, y);
                        return str;
                    },
                    projection: projection,
                    tileGrid: new ol.tilegrid.TileGrid({
                        resolutions: resolutions11,
                        tileSize: [256, 256],
                        origin: [-20037508.3427892, 0],
                      
                    })
                })
            });
            map.addLayer(layer);

2、4326坐标系下加载google影像

var urlstr = "google影像瓦片存放地址";

var tileSize = 256;
            var resolutions = 22;
            for (var i = 0, ii = resolutions.length; i < ii; ++i) {
                resolutions[i] = 180 / Math.pow(2, i) / tileSize;
            }
            var layer = new dev.layer.Tile({
                id: ID,
                tag:Tag,
                zIndex: 0,
                opacity: 1,
                visible:  true,
                source: new dev.source.XYZ({
                    tileSize: tileSize,
                    tileUrlFunction: function (tileCoord, s, e) {
                        var z = tileCoord[0];
                        var x = tileCoord[1];
                        var y = tileCoord[2];
                        var re = new RegExp('\\{z\\}', 'gm');
                        var re1 = new RegExp('\\{x\\}', 'gm');
                        var re2 = new RegExp('\\{y\\}', 'gm');
                        var str = urlstr.replace(re, z);
                        str = str.replace(re1, x);
                        str = str.replace(re2, y);
                        return str;
                    },
                    projection: 'EPSG:4326',
                    tileGrid: new dev.tilegrid.TileGrid({
                        resolutions: resolutions,
                        tileSize: tileSize,
                        origin: [-180, -90]
                    })
                })
            });
            map.addLayer(layer);

其实不同坐标系下加载影像要注意的参数就是  resolutions 和origin