Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I select a feature in a cluster #226

Closed
panchofrank opened this issue Sep 6, 2019 · 4 comments
Closed

How do I select a feature in a cluster #226

panchofrank opened this issue Sep 6, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@panchofrank
Copy link

Hello,

I'm trying to programmatically select a feature that is in a cluster: https://jsfiddle.net/Francoisgaudin/2bxdjuwg/

When I select the feature by clicking on it we see that the feature appears in an array as a field in another feature. I guess that other feature represents the cluster and it has a generated id. When we enter that ID in the jsfiddle text box and attempt to select by pressing the button nothing happens.
Also I can't find the cluster features using a getFeatures call on the source of the layer.
What am I doing wrong?

@panchofrank
Copy link
Author

So I manage to do the selection with the following call:

this.$refs.interaction.select(this.$refs.clusterLayer.getSourceTarget().values_.source.getFeatures()[0])

Is there a more concise way to the feature?

@ghettovoice ghettovoice self-assigned this Sep 6, 2019
@ghettovoice
Copy link
Owner

Hello @panchofrank ,
your fiddle is how it should work, but for now vl-source-cluster a bit buggy.
I see 3 problems with it:

  • id dynamically generated 2 times for same cluster, so you can't get correct id
  • vl-source-cluster doesn't allow generate cluster properties by some user defined handler
  • vl-source-cluster doesn't emit update:features event like vl-source-vector, so you can't listen for clustered features changes

I'll try to release patch as soon as possible.
Thanks for pointing me to this problems!

@ghettovoice ghettovoice added the bug label Sep 6, 2019
@ghettovoice ghettovoice added this to the v0.11.5 milestone Sep 6, 2019
ghettovoice added a commit that referenced this issue Sep 27, 2019
Let Vue update reactive properties before transmitting ol events.
So at the event time all computed properties (like source features)
should be already updated.

#132 #224 #225 #226
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #132 #224 #225 #226, #230
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
@alejandrosuarez231
Copy link

@ghettovoice Hi! How are you? I am working on a map which I need to show the elements grouped by cluster, but I must also show the lines that join the points (LineString) only when the points are visible and not grouped

@ghettovoice
Copy link
Owner

Hi @alejandrosuarez231 ,
I don't actually know what you want to implement.
But I think this very basic example should show you an idea to use dynamic linestrings layer
https://jsfiddle.net/ghettovoice/qa8p913o/231/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants