O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting features intersecting with a line

One common action when working with features within a vector layer is its selection and, of course, OpenLayers has some feature selection controls.

The OpenLayers.Control.SelectFeature control is specially useful as a selection control because the selection is made on the client side, that is, the selection is made through the features loaded in the browser. There is no request to a WFS server.

The OpenLayers.Control.SelectFeature control can work in different ways. We can select a feature just by clicking on it or we can draw a box to select all the contained features.

In contrast, it does not allow the possibility to select features that intersect with a path.

In this recipe, we are going to see how we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required