我正在使用OpenLayers开展一个地图项目,我想在其上显示Google图像底图上的街道数据。 ESRI通过其ArcGIS REST服务器提供了良好的街道覆盖,但我无法让OpenLayers加载它。我已经尝试过遵循文档和this example,并且无法弄清楚我在做什么,这使得它无法正常工作。它将在图层面板中添加一个新图层以及Google Satellite底图,但该图层中没有任何内容加载 - 它是空白的。这是我的代码:
function addOpenLayers() {
var mapcenter = new OpenLayers.LonLat(-90.8, 46.45)
var base = new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels:22});
var olOptions = {
controls: [new OpenLayers.Control.PanZoomBar, new OpenLayers.Control.LayerSwitcher, new OpenLayers.Control.Navigation],
}
var olMap = new OpenLayers.Map("map", olOptions);
olMap.addLayer(base);
olMap.setCenter(mapcenter.transform(
new OpenLayers.Projection("EPSG:4326"),
olMap.getProjectionObject()
), 10);
//This is the part that doesn't work:
var esriRoadsUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer";
var esriRoads = new OpenLayers.Layer.ArcGIS93Rest("Roads", esriRoadsUrl, {layers: "show:0"});
esriRoads.isBaseLayer = false;
olMap.addLayer(esriRoads);
}