以下是我在openlayers地图上添加图片的代码。
var image = new OpenLayers.Layer.Image(
'Image 1',
'http://belocalat.com/wp-content/plugins/openlayers/data/baselayer-img1.png',
//new OpenLayers.Bounds(27.418100,35.771100,28.388000,36.558500),
new OpenLayers.Size(800,255),
{isBaseLayer: false}
);
map.addLayer(image);
但是,我无法在openlayers上显示图像。 谁能给我解决这个问题?
提前致谢。
答案 0 :(得分:3)
我尝试过以下代码并且已经有效了。从fiddle退房。别忘了从layerswitcher中选择Image layer。
var osm = new OpenLayers.Layer.OSM();
var graphic = new OpenLayers.Layer.Image(
'Image',
'http://belocalat.com/wp-content/plugins/openlayers/data/baselayer-img1.png',
new OpenLayers.Bounds(27.418100,35.771100,28.388000,36.558500),
new OpenLayers.Size(800,255),
{numZoomLevels: 3}
);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addLayers([osm, graphic]);
map.zoomToExtent(new OpenLayers.Bounds(27.418100,35.771100,28.388000,36.558500));
我希望它可以帮助你...