如何添加具有两个不同投影的基本层?
我添加了具有不同投影的覆盖层(EPSG:4326),但是我需要添加具有各种投影的基础层
- 谷歌地图
- 我的带有EPSG:4326投影的矢量层
我可以看到Google Maps一切都很好,但是当我将基本层切换到EPSG:4326层时,一切都是白色的。
window.onload = function init(){
var lon = 84;
var lat = 28;
var zoom = 8;
var url = "http://10.6.7.6/geoserver/wms";
var mapControls = [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults()
];
var map = new OpenLayers.Map(
'map',
{
numZoomLevels: 21,
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
controls: mapControls
});
var dsb = new OpenLayers.Layer.WMS(
"Nepal Border",
url,
{layers: 'GisData:IR'}
);
var gmap_gs = new OpenLayers.Layer.Google(
"Google Streets",// the default
{'sphericalMercator': true}
);
var dG = new OpenLayers.Layer.WMS(
"2G Down Sites",
url,
{layers: 'GisData:dG', transparent: "true",format: "image/png"},
{
isBaseLayer: false,
buffer: 0
});
map.addLayers([dsb, dG,gmap_gs]);
var proj = new OpenLayers.Projection("EPSG:4326");
var point = new OpenLayers.LonLat(lon,lat);
point.transform(proj, map.getProjectionObject());
map.setCenter(point, zoom);
}