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

Click on cluster points to get all contained points properties #2661

Closed
TZTony opened this issue Jun 3, 2016 · 6 comments
Closed

Click on cluster points to get all contained points properties #2661

TZTony opened this issue Jun 3, 2016 · 6 comments

Comments

@TZTony
Copy link

TZTony commented Jun 3, 2016

mapbox-gl-js version:0.18.0

Steps to Trigger Behavior

Hi
I am new to mapboxgl, I have a question about how I can get all points belong to a certain cluster point? based on the example, I am able to generate a cluster markers and when mouse click on cluster circle, using following code only be able to get total points. so it will be good to have a properties with a array of points in the resource.

var features = mapBox.queryRenderedFeatures(e.point, { layers: ['cluster'] });
if (!features.length) {
 return;
}               
var feature = features[0];
var totalNum = feature['point_count'];

Expected Behavior

I hope it can return value from geoJsonSource list this.

{
   cluster : 1,
   point_count : integer,
   point_count_abbreviated : integer,
   **points_properties : included points properties array,**
}

Or if there is another solution can solve my problem, it will be great

Thanks

@karlguillotte
Copy link
Contributor

karlguillotte commented Jun 9, 2016

Looking for a similar Expected Behavior. I need those points to compute bounds that I will use to call fitBounds on my map object.

I think it will not be fixed anytime soon #2384.

@lucaswoj
Copy link
Contributor

lucaswoj commented Jun 9, 2016

This issue is a duplicate of #2358. Sorry! This functionality would be nice but it is not practical.

@lucaswoj lucaswoj closed this as completed Jun 9, 2016
@TZTony
Copy link
Author

TZTony commented Jun 16, 2016

I understand the way for store all those points in cluster point's properties is ambition. But I wonder is there another way to get those points by a method or calculation from the source. I can see the index process is using kdbush, but i don't know is it possible to generate those points again when click on a cluster point.

@barrylachapelle
Copy link

https://jsfiddle.net/aznkw784/

@sdawson26
Copy link

@barrylachapelle The results that print don't always reflect the count on the cluster. It would be nice if we could make this more accurate.

@schellenbergk
Copy link

bump!

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

No branches or pull requests

6 participants