弄在线 调用的url有弄过的吗
因为项目需要 弄成超图底图 把百度底图改成超图。
所以 找了两天。。。。
// 百度地图层
var projection = ol.proj.get("EPSG:3857");
var resolutions = [];
for(var i=0; i<19; i++){
resolutions[i] = Math.pow(2, 18-i);
}
var baiduMapLayer = new ol.layer.Tile({
source: new ol.source.TileImage({
crossOrigin: 'anonymous',
projection: projection,
tileGrid: new ol.tilegrid.TileGrid({
origin: [0,0],
resolutions: resolutions
}),
tileUrlFunction: function(tileCoord, pixelRatio, proj){
if(!tileCoord){
return "";
}
var z = tileCoord[0];
var x = tileCoord[1];
var y = tileCoord[2];
if(x<0){
x = "M"+(-x);
}
if(y<0){
y = "M"+(-y);
}
return "http://online3.map.bdimg.com/onlinelabel/?qt=tile&x="+x+"&y="+y+"&z="+z+"&styles=pl&udt=20151021&scaler=1&p=1";
}
})
});
//超图底图
var superMapTileLayer = new ol.layer.Tile({
source: new ol.source.XYZ({
// url: "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
})
});
GIS中调用
var map = new ol.Map({
controls: ol.control.defaults().extend([
new ol.control.ScaleLine({})
]),
layers : [superMapTileLayer],
overlays : [ popupOverlay ],
target : 'map',
view : new ol.View({
center : [106.251367,37.472274],
projection : 'EPSG:4326',
zoom : 8
})
});
唉弄不出来。。。。。。大神们求看看。解决现在 已经遇到坑了
大神们留步