android - Algorithm to space/filter Google Maps Markers for readability? -
in android app plot airports on google maps. when zoomed out far, density gets high. i'm familiar marker clustering libraries, rather have solution distribution of airports shown, leaving out overlapping ones, , when zoom in more airports filled in needed. tips on this.
clustering need.
you need to:
- position cluster @ same
latlng
1 of markers in cluster - use same icon cluster regular markers
taking example android maps extensions, i'm familiar with, have modify code in clustermarker.java from
private latlng calculateclusterposition() { latlngbounds.builder builder = latlngbounds.builder(); (delegatingmarker m : markers) { builder.include(m.getposition()); } return builder.build().getcenter(); }
to like
private latlng calculateclusterposition() { return markers.get(0).getposition(); }
or bit more sophisticated algorithm, calculates center , iterates on markers again find nearest marker , use position.
Comments
Post a Comment