我正在使用几种类型的baselayers(参见下面的代码):
所有这些都可以切换,并且瓷砖可以正确显示,那里没有问题。
事情是:虽然1和2工作得很好,但是当我切换到任何其他层时,所有其他层(插入为geojson' EPSG:4326投影)显示在一个点上分组屏幕,好像所有屏幕都有相同的坐标。
我的猜测是,EPSG:4326和EPSG:900913预测之间存在一些干扰,但我现在陷入困境。
function init(){
map = new OpenLayers.Map( 'map' );
var baseLayers = GetBaseLayers();
map.addLayers(baseLayers);
stateBordersText = //geojson ...
stateBordersLayer = new OpenLayers.Layer.Vector('State borders');
map.addLayer(stateBordersLayer);
stateBordersLayer.addFeatures(geojson_format.read(stateBordersText));
// etc ...
}
function GetBaseLayers(){
emptyBaselayer = new OpenLayers.Layer("Empty BaseLayer", {isBaseLayer: true, displayInLayerSwitcher: true});
defaultBaselayer = new OpenLayers.Layer.WMS("OpenLayers Basic", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'});
var mapnik = new OpenLayers.Layer.OSM();
mapnik.transitionEffect = "resize";
//Source: http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/
var gphy = new OpenLayers.Layer.Google("Google Physical",{type: google.maps.MapTypeId.TERRAIN});
var gmap = new OpenLayers.Layer.Google("Google Streets",{numZoomLevels: 22});
var gsat = new OpenLayers.Layer.Google("Google Satellite",{type: google.maps.MapTypeId.SATELLITE,sphericalMercator:true,numZoomLevels:22,layers: 'basic'});
var baseLayers = [emptyBaselayer,defaultBaselayer,mapnik,gphy,gmap,gsat];
return baseLayers;
}