Closed KentDi808 closed 6 years ago
I have come up with a solution that gets me the data that I need.
Modifying the onClick to encode the cluster_id gets all of the items in the cluster.
const cluster_id = (id << 5) + (zoom + 1);
Thanks in advance.
The Webpack bin isn't loading for me for some reason... I'd guess that you're experiencing this issue because GL JS still uses Supercluster 2.3.0, which doesn't encode zoom into ids. We should upgrade there. Let's close here since it's not directly a supercluster issue.
I'm okay with closing it. For some reason if you do a hard refresh the WebpackBin it will render correctly. Also, thanks for the great work you are doing.
Just get same issue.
After 3 hours of tracing the code, figured out that some of the cluster properties has an empty latitude
or longitude
. 😅
Filter the data before assign it to the points array. Solved.
Posted here to remind myself or others in the future for easy googling.
Just get same issue. After 3 hours of tracing the code, figured out that some of the cluster properties has an empty
latitude
orlongitude
. 😅 Filter the data before assign it to the points array. Solved.Posted here to remind myself or others in the future for easy googling.
You're right. Got the same issue and thanks to your comment!
I am using react-mapbox-gl@3.4.1 and supercluster@3.0.2 to get the list of features in a clicked cluster.
I saw that in V3.0.0 of supercluster the zoom factor is encoded into the cluster_id.
I am using a GeoJSONLayer to do the clustering (which may not be the right way to do it for supercluster) and the correct features are not returned OnClick.
Clicking some clusters throws a run-time error:
Any idea why no features or the wrong features are being returned?
WebpackBin Showing a working example of the issue.
Any help would be appreciated.