1

Is there a way I can get all the features from a OpenLayers Vector layer that are visible on the map?

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.

Is there a way to programmatically get the visible features on the map?

Thanks

Mo.
  • 40,243
  • 37
  • 86
  • 131

1 Answers1

0

OL2 solution, my answer from 2013:

Have a look at the onScreen method of OpenLayers:

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

OL3 solution:

Get all features from the Openlayers 3 viewport

Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85