将图片添加到openlayers地图 [英] Add image to openlayers map
本文介绍了将图片添加到openlayers地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我在openlayers地图上添加图像的代码。
Here is my code for adding a image on openlayers map.
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上显示图像。
可以给任何人给我解决方案吗?
but, i can't display image on openlayers. can anyone give me solution for this ?
提前感谢
推荐答案
我已经尝试了以下代码,它已经工作。请从小提琴查看。不要忘记从layerswitcher中选择图像层。
i have tried following code and it has worked. check out from fiddle. dont forget to select Image layer from layerswitcher.
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));
我希望它可以帮助你...
i hope it helps you...
这篇关于将图片添加到openlayers地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文