Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenLayers 3 Disable Multi-Select

Tags:

openlayers-3

Is there a way to have a selectInteraction in OpenLayers 3 that only allows one feature to be selected at a time?

like image 282
Tyler DeWitt Avatar asked May 01 '15 15:05

Tyler DeWitt


2 Answers

define select interaction as follow:

select = new ol.interaction.Select (
    toggleCondition: ol.events.condition.never
)
like image 64
Paul Avatar answered Sep 25 '22 19:09

Paul


Not really sure I understood well.

If you go to the API doc for OpenLayers 3.4 and untick Stable Only on the page top right, you will see a multi option to manage this. Normally, according to the doc, what you are asking is already by default.

Multi A boolean that determines if the default behaviour should select only single features or all (overlapping) features at the clicked map position. Default is false i.e single select

like image 37
Thomas Gratier Avatar answered Sep 22 '22 19:09

Thomas Gratier