开发者

with openlayers , how do i make sure a list of points are all displayed?

I have an OpenLayers map object, and I have added markers to a layer, and added it to the map.

But how do I开发者_C百科 make sure all the markers are in the display area?

Thanks,

Gil


In order to display all markers on the map
Firstly,make sure you have all markers in one layer.
Secondly,you need to zoom to bound where all markers in marker layer are extended.
To do that,simply

   var bounds = markerLayer.getDataExtent();
   map.zoomToExtent(bounds);
   //has a second parameter that decides to find closest zoom level
   //default is false

Please check OpenLayers Document for Marker Layer

Best Regards
Myra

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜