How do I manually cause a 'select' event on an Openlayers 3 ol.interaction.Select?

ryansstack

I'd like to cause an ol.interaction.Select obj to 'select' a feature when the user clicks on a button which is related to that feature. I'd like to be able to reuse the event handling code I already use for when a user clicks on a feature.

Is there a way to do this with the Select interaction?

Jonatas Walker
<!-- UPDATE -->

Maybe when this PR get merged we can dispatch select event. About reusing code, I guess you can solve this wrapping it on a function, and when push a feature to the collection, call your function with that feature.

<!-- End of update -->

Get the ol.interaction.Select collection and push or pop as you want:

var select = new ol.interaction.Select({
    //some options
});
map.addInteraction(select);

var collection = select.getFeatures();
collection.push(some_feature);

//or push an array of features
collection.extend(some_array_features);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Openlayers 3: how to select a feature programmatically using ol.interaction.Select?

From Dev

select event for getting coordinate in openlayers3

From Dev

Openlayers setState on Select event

From Dev

ol.interaction.Select gives an error on ol.source.VectorTile

From Dev

OpenLayers 3 Interaction Style Conflict with ol.feature.setStyle

From Dev

OL3 : Select Image/Marker to drag drop to another coordinate (Visual Issues OpenLayers 3)

From Dev

OpenLayers 3 Draw Interaction onFeature added event

From Dev

How do I reload Jquery jtable with change in URL on select event

From Dev

How do I programatically select an option when I'm defining them manually in Rails?

From Dev

How to manually set the value (and trigger the select event) to jQuery autocomplete

From Dev

Openlayers 3: Select a feature programmatically

From Dev

How to apply a style to the modify interaction in OpenLayers 3?

From Dev

Openlayers 3 - Interaction and pointermove

From Dev

ol3 / OpenLayers 3: How to use readNetworkLinks method for ol.format.KML()?

From Dev

How do I make check-boxes respond to a select all function after I manually checked and unchecked them?

From Dev

Manually select location, how to implement?

From Dev

How do I fire a new ajax on select2 new /remove tag event?

From Dev

Google Chart : How do I add select event handler to the pie chart?

From Dev

How do I fire a new ajax on select2 new /remove tag event?

From Dev

In React how do I set the value of a select based on an event from another element

From Dev

How to select the drillup button using jquery, so I can do an on click event?

From Dev

How do I do this sql select query?

From Dev

Openlayers 3 : Interaction DragBox not working

From Dev

How do I use SELECT GROUP BY in DataTable.Select(Expression)?

From Dev

How do I use SELECT GROUP BY in DataTable.Select(Expression)?

From Dev

How do i populate a select with a db call based on another select

From Dev

How do i select a .html file and launch it with the <select>

From Dev

How do I get value of <select> when a user select a item

From Dev

Openlayers 3 ol.animation.pan with timeout?

Related Related

  1. 1

    Openlayers 3: how to select a feature programmatically using ol.interaction.Select?

  2. 2

    select event for getting coordinate in openlayers3

  3. 3

    Openlayers setState on Select event

  4. 4

    ol.interaction.Select gives an error on ol.source.VectorTile

  5. 5

    OpenLayers 3 Interaction Style Conflict with ol.feature.setStyle

  6. 6

    OL3 : Select Image/Marker to drag drop to another coordinate (Visual Issues OpenLayers 3)

  7. 7

    OpenLayers 3 Draw Interaction onFeature added event

  8. 8

    How do I reload Jquery jtable with change in URL on select event

  9. 9

    How do I programatically select an option when I'm defining them manually in Rails?

  10. 10

    How to manually set the value (and trigger the select event) to jQuery autocomplete

  11. 11

    Openlayers 3: Select a feature programmatically

  12. 12

    How to apply a style to the modify interaction in OpenLayers 3?

  13. 13

    Openlayers 3 - Interaction and pointermove

  14. 14

    ol3 / OpenLayers 3: How to use readNetworkLinks method for ol.format.KML()?

  15. 15

    How do I make check-boxes respond to a select all function after I manually checked and unchecked them?

  16. 16

    Manually select location, how to implement?

  17. 17

    How do I fire a new ajax on select2 new /remove tag event?

  18. 18

    Google Chart : How do I add select event handler to the pie chart?

  19. 19

    How do I fire a new ajax on select2 new /remove tag event?

  20. 20

    In React how do I set the value of a select based on an event from another element

  21. 21

    How to select the drillup button using jquery, so I can do an on click event?

  22. 22

    How do I do this sql select query?

  23. 23

    Openlayers 3 : Interaction DragBox not working

  24. 24

    How do I use SELECT GROUP BY in DataTable.Select(Expression)?

  25. 25

    How do I use SELECT GROUP BY in DataTable.Select(Expression)?

  26. 26

    How do i populate a select with a db call based on another select

  27. 27

    How do i select a .html file and launch it with the <select>

  28. 28

    How do I get value of <select> when a user select a item

  29. 29

    Openlayers 3 ol.animation.pan with timeout?

HotTag

Archive