简体   繁体   English

如何在OpenLayers的地图上显示所有功能?

[英]How can I get all the features displayed on a map in OpenLayers?

Is there a way I can get all the features from a OpenLayers Vector layer that are visible on the map? 有没有办法我可以从OpenLayers Vector图层中获取在地图上可见的所有功能?

For example what if the layer has 100 features, but at the zoom level I am at, at the moment I can only see 20 of these features. 例如,如果该图层具有100个要素,但是处于我的缩放级别,此刻我只能看到其中的20个要素。

Is there a way to programmatically get the visible features on the map? 有没有办法以编程方式获取地图上的可见特征?

Thanks 谢谢

OL2 solution, my answer from 2013: OL2解决方案,我在2013年的回答:

Have a look at the onScreen method of OpenLayers: 看一下OpenLayers的onScreen方法:

http://dev.openlayers.org/docs/files/OpenLayers/Marker-js.html#OpenLayers.Marker.onScreen http://dev.openlayers.org/docs/files/OpenLayers/Marker-js.html#OpenLayers.Marker.onScreen

OL3 solution: OL3解决方案:

Get all features from the Openlayers 3 viewport 从Openlayers 3视口中获取所有功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM