You need to clear the collection of the Select interaction.
Best regards,
Bart
> On 3 Oct 2016, at 17:52, Chen Kun via OL3 Dev
> <ol3-dev+apn2wqe5pqw91n48ond4af_wfxryjykp6zlidtnwxx5pcenzxm19j...@googlegroups.com>
> wrote:
>
> I am doing a maplayer switch function but when I switch the layer, the
> selected feature is not unselected. May I know how to unselect a feature in
> openlayer 3.
>
>
>
> $("#show-field-map").click(function(event) {
> map.removeLayer(subbasinJsonp);
> map.addLayer(fieldJsonp);
> $('#show-subbasin-map').attr("disabled", false);
> $('#show-field-map').attr("disabled", true);
> });
>
> $("#show-subbasin-map").click(function(event) {
> map.removeLayer(fieldJsonp);
> map.addLayer(subbasinJsonp);
> $('#show-field-map').attr("disabled", false);
> $('#show-subbasin-map').attr("disabled", true);
> });
>
> --
> You received this message because you are subscribed to the Google Groups
> "OL3 Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/ol3-dev
> <https://groups.google.com/group/ol3-dev>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ol3-dev/e8b5ec52-ee62-4e84-867c-62a980c6f367%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ol3-dev/e8b5ec52-ee62-4e84-867c-62a980c6f367%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups "OL3
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ol3-dev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ol3-dev/50309018-24BF-4F4E-8F80-C56B1E7C87E0%40boundlessgeo.com.
For more options, visit https://groups.google.com/d/optout.