我有一张地图,上面覆盖了谷歌街道地图和一些 WMS。它一直工作到昨天,但是,今天我突然可以看到地图,但是错过了缩放按钮!我正在使用 Google 地图 API v2、Openlayaers 和 Geoext API。我的代码是:
Ext.onReady(function () {
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)
};
var map = new OpenLayers.Map(options);
var gmap = new OpenLayers.Layer.Google(
"Google Streets",
{ isBaseLayer: true, numZoomLevels: 20, sphericalMercator: true }
);
map.addLayer(gmap);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{ type: G_SATELLITE_MAP, 'sphericalMercator': true, numZoomLevels: 20 }
);
map.addLayer(gsat);
var mappanel = new GeoExt.MapPanel({
region: "center",
map: map,
title: 'Map Layers on Google'
});
var layerList = new GeoExt.tree.LayerContainer({
text: 'Map Layers',
layerStroe: mappanel.layers,
leaf: false,
expanded: true
});
var layerTree = new Ext.tree.TreePanel({
title: 'Map Layers',
maxWidth: 500,
Width: 300,
region: "west",
collapsible: true,
collapsed: true,
root: layerList,
split:true
});
var descriptionPanel = new Ext.Panel({
title: 'Metadata Description',
Width: 400,
region: "east",
contentEl: "description",
collapsible: true,
collapsed: false,
split:true
});
var mainPanel = new Ext.Panel({
height: 800,
renderTo: "mainpanel",
layout: "border",
items: [mappanel, layerTree, descriptionPanel]
});
有没有人可以让我知道一切正常时发生了什么!顺便说一句,我前几天收到了谷歌的一封电子邮件,谷歌地图 v2 已经过期,下个月就要下线了!也许他们更早关闭它!
干杯,