OCMapView
OCMapView copied to clipboard
Improved Minimun Zoom implementation strategy
-Before, the minimum Zoom level to perform clustering was defined by the property 'minLongitudeDeltaToCluster'. The problem With this approach is that the equivalent value for 1 degree of Longitude values vary (according to latitude values) from 0 meters in the poles, to 111319.46 meters in the equator. This means that if we set:
minLongitudeDeltaToCluster = 1.0
If the latitude is 90 or -90, it will ALWAYS perform clustering, and if the latitude is 0, it will perform clustering when we zoom out the equivalent to 111 Kilometers.
On the other hand, Latitude distances does not vary in such a big way, and are therefore a better way to reference the current level of zoom.
-Based on this principle, I've added the property
@property(nonatomic, assign) CLLocationDegrees minLatitudeDeltaToCluster;
The ideal thing would be to completely remove the minLongitudeDeltaToCluster property, but considering compatibility issues, it's been Deprecated:
@property(nonatomic, assign) CLLocationDegrees minLongitudeDeltaToCluster DEPRECATED_MSG_ATTRIBUTE("Use minLatitudeDeltaToCluster instead.");
Right Now the algorithm considers BOTH parameters when evaluating the zoom level, but on the next release it should only use the minLatitudeDeltaToCluster value.
I hope it was helpful =)