OCMapView icon indicating copy to clipboard operation
OCMapView copied to clipboard

Annotation views in Part of the world

Open SimonFoskolos opened this issue 10 years ago • 3 comments

Hi,

Using the sample project, and pressing the add 100 annotations button over America, nothing happens. When i scroll the map a little to the right/left the annotations appear, when i centre it over America, they disappear again.

Kind regards Simon

SimonFoskolos avatar Jul 16 '14 16:07 SimonFoskolos

Well i should have checked the last pull request... I will revert asap to an working version

BotiKis avatar Jul 16 '14 17:07 BotiKis

Hi, In function call rangeContainsValueModulo i changed argument region.center.longitude to fabs(region.center.longitude) and pt.longitude to fabs(pt.longitude) and the annotations were displayed. Is this ok, or am i missing some bigger picture ?

SimonFoskolos avatar Jul 17 '14 07:07 SimonFoskolos

Hit a problem which might be a symptom of the same issue. From master, I updated existing working code from a March OCMapView commit to the commit 46261ecd9, and stopped getting callbacks to viewForAnnotation:. Dug deeper and found the 4x pins in the mapRegion in my initial test were being filtered out by rangeContainsValueModulo in OCDistance.m as not being in the region.

You might want to retest with coordinates -33.8686, 151.2051 i.e. Sydney (southern hemisphere). It was turning the lat -33 into +146 (i.e. mod 180), but comparing the original value -33 against the positive start and end values (in the 140s), so all pins were filtered out. I patched it by adding value = modulo(value,modul); just after the similar operation was done on "pt", so all values are +ve. Either that or the modulo logic isn't sensible across lat AND long, +ve and -ve.

As this seems to satisfy Simon's case (-ve longitude) as well as ours (-ve latitude).. is it this a more general fix ?

Great module though.

cossorn avatar Jul 30 '14 05:07 cossorn