On Thu, Jan 13, 2011 at 10:38 AM, Stephan Wiesner < [email protected]> wrote:
> Thanks for your reply. I have thought about that, but can't find a good > solution for that either. Sure, nobody needs them all at zoomed out level. > But the user needs to see that there are at least some at a location (like I > said, whole country). So I would have to, don't know, show only one in ten > or something like that. They are clustered in the mountains and far between > in other areas. Meaning I would have to calculate, what? The distance > between all points? How would I decide which to display and which not to > display? > As MrChaz alluded to, you'll want to cluster your points at zoomed out levels. One dumb implementation could, for each zoom level, define a "Cluster" which is a collection of markers. You'll have a set of Clusters and a pivot point in each cluster to compare to. For each of your markers, iterate over you set of clusters. For each cluster compare the market against the pivot . If it's close enough (in screen terms) you add it to that pivot's cluster, otherwise it starts it's own cluster and becomes the pivot of that cluster. Once you're done you'll have a set of clusters for each zoom level and that's all you'll have to display, either based on the pivot or the average location of all markers in the cluster. You can cache this data structure so you don't have to rebuild it each time and perhaps only load the cluster set for a given zoom level when the user zooms to that level. I just pulled that out of my ass so no idea how practical it actually is, but should give you some idea on how to proceed =). ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

