OCMapView icon indicating copy to clipboard operation
OCMapView copied to clipboard

Issue or Feature...

Open ghost opened this issue 11 years ago • 4 comments

Hello,

I am using OCMapView in an App and it is wonderful!!! But I do have a question about the way the cluster is determined. In regionDidChangeAnimated I call doClustering but as I move the map around the screen the pins sometime change location slightly with the region. By region I am referring to the yellow circle around the clustered area. Without looking too much into the source, I was guessing that this is due to the fact that the long and lat of the pin pin which marks the circle is changing.

Is this the way it should work, or can this be corrected by possibly sorting the longs and lats in the region and then the one used for the pin would be the same each time?

This would of course not make a difference if the map was zoomed but it may help when moved.

Anyway, maybe it is just something I am doing wrong but in any case OCMapView is great!!

ghost avatar Mar 06 '13 17:03 ghost

Hello there,

Yes, this is the way it works by default.
This happens because only annotation in the visible area are calculated to increase performance. You can turn it of by enabling the clusterInvisibleViews property. On newer devices (iphone 4s and up) this should be alright for some thousand annotations.

Thank you and you are welcome. :]

BotiKis avatar Mar 06 '13 19:03 BotiKis

Great, I will try that property since I only have around 200 annotations.

Also, can you tell me more about the clusterSize property? I don't really understand what that is doing. I set it to 0.2 in my app, but it seems to operate funny.

Thanks again, Tony

On Mar 6, 2013, at 2:02 PM, "Botond Kis" [email protected] wrote:

Hello there,

Yes, this is the way it works by default.

This happens because only annotation in the visible area are calculated to increase performance. You can turn it of by enabling the clusterInvisibleViews property. On newer devices (iphone 4s and up) this should be alright for some thousand annotations.

Thank you and you are welcome. :]

— Reply to this email directly or view it on GitHub.

ghost avatar Mar 06 '13 19:03 ghost

After enabling clusterInvisibleViews app falled in MKMapView : ; insertionNodeForItem(objc_object, MKQuadTrieNode_)

Call stack looks like this: #0 0x000f54a0 in contains(objc_object, MKQuadTrieNode_) () <<<<<< here falled down #4 0x000c7653 in -MKMapView addAnnotations: #5 0x00009692 in -[OCMapView doClustering] at /Users/rokemoon/Downloads/OCMapView-master 2/OCMapView/OCMapView.m:177 #6 0x000055b3 in -[OClusterMapView_SampleViewController mapView:regionDidChangeAnimated:] at /Users/rokemoon/Downloads/OCMapView-master 2/OClusterMapView+Sample/OClusterMapView_SampleViewController.m:285 #7 0x000c06b6 in -MKMapView _didChangeRegionMidstream:

Number of annotations 5000, but sometimes it's falling when I press "add 100 random". With 1000 the same bahaviour.

For testing I'm using your example, enabling clusterInvisibleViews here:

  • (void)viewDidLoad { [super viewDidLoad]; mapView.delegate = self; mapView.clusterSize = kDEFAULTCLUSTERSIZE; mapView.clusterInvisibleViews = YES; labelNumberOfAnnotations.text = @"Number of Annotations: 0"; }

Falles when zooming map. Maybe I'm doing it wrong?

rokemoon avatar Mar 06 '13 19:03 rokemoon

Have this bug with disabled clusterInvisibleViews, but annotations count were 9000. For replying this bug you should zoom and move map, in a few minutes it's falls.

rokemoon avatar Mar 06 '13 19:03 rokemoon