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

Expose minimum and maximum zoom for clusters #2457

Closed
tmcw opened this issue Apr 17, 2016 · 6 comments
Closed

Expose minimum and maximum zoom for clusters #2457

tmcw opened this issue Apr 17, 2016 · 6 comments

Comments

@tmcw
Copy link
Contributor

tmcw commented Apr 17, 2016

mapbox-gl-js version: latest

Steps to Trigger Behavior

  1. Design a map that uses clusters
  2. Intend to zoom to a level where a given cluster is expanded to show points
  3. While we have a property for how many points are in a cluster, we don't have one for this.

Expected Behavior

Clusters contain a min_zoom property and max_zoom for the bounds at which they are clustered.

Actual Behavior

They don't


Implementation-wise, supercluster's getClusterProperties method should expose the value of the cluster's max zoom. Behind that, clusters have a zoom property but this is the last zoom at which they are processed: this will need to include their range as well.

@mourner
Copy link
Member

mourner commented Apr 18, 2016

Why do you need these properties? Something like "click to expand" that would zoom in by one level in most cases but sometimes more?

@tmcw
Copy link
Contributor Author

tmcw commented Apr 18, 2016

Something like "click to expand" that would zoom in by one level in most cases but sometimes more?

Yep, that'd be one of the primary usecases - @arunasank can go into more detail about how this number would be useful for her project.

@arunasank
Copy link

Something like "click to expand" that would zoom in by one level in most cases but sometimes more?

@mourner Exactly. If we had a property to reveal the exact zoom at which a cluster splits, it'll be easy to just split on click sometimes.

It's useful when the points that make a cluster are very very close to each other sometimes, and spread apart at others.

I have some clusters on http://arunasank.github.io/labhopping. The cluster on the bottom left splits at zoom 6, but the one on the top right only splits at zoom level 19 or so.

@mourner
Copy link
Member

mourner commented Apr 18, 2016

@arunasank Sounds good! I'll look into it after vacation. Click to expand would be for the cluster max zoom, but what use case do you have for min zoom?

@arunasank
Copy link

@mourner \o/ The cluster max zoom would be super useful for our project, thanks! : )

I can't think of many use cases for the min zoom besides

  • Click to zoom back out into cluster-view if you're in non-cluster-view.
  • Instead of smooth zoom-in and zoom-out, zoom-in and zoom-out to have only two views - cluster or non-cluster by using your current cursor location to center the map.

@mourner
Copy link
Member

mourner commented Jul 24, 2018

Added in #6829

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

No branches or pull requests

3 participants