maxZoomLevel on Retina Display #131

Open
vedas opened this Issue Aug 10, 2011 · 3 comments

Comments

Projects
None yet
4 participants

vedas commented Aug 10, 2011

When testing on device and simulator with a retina display the maxZoomLevel is not obeyed. This results in the application crashing.

I have a simple application with a custom MBTiles file with level 12-16. I've also tested 14-17. On retina devices it seems to show level 15 tiles for level 14.

Any suggestions about how to fix this?

2011-08-10 13:08:49.604 Test App [21403:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<RMMBTilesTileSource: 0x9e00ea0> tried to retrieve tile with zoomLevel 17, outside source's defined range 12.000000 to 16.000000'

*** Call stack at first throw:
(
    0   CoreFoundation                      0x010afbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x012045c2 objc_exception_throw + 47
    2   CoreFoundation                      0x01068628 +[NSException raise:format:arguments:] + 136
    3   Foundation                          0x0014e47b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4   Test App                            0x0001c7c5 -[RMMBTilesTileSource tileImage:] + 300
    5   Test App                            0x0001412b -[RMCachedTileSource tileImage:] + 124
    6   Test App                            0x00008853 -[RMTileImageSet addTile:At:] + 235
    7   Test App                            0x0000a481 -[RMTileImageSet addTiles:ToDisplayIn:] + 862
    8   Test App                            0x0000ad65 -[RMTileLoader updateLoadedImages] + 548
    9   Foundation                          0x000bd6c1 _nsnote_callback + 145
    10  CoreFoundation                      0x01087f99 __CFXNotificationPost_old + 745
    11  CoreFoundation                      0x0100733a _CFXNotificationPostNotification + 186
    12  Foundation                          0x000b3266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134
    13  Foundation                          0x000bf5a9 -[NSNotificationCenter postNotificationName:object:] + 56
    14  Test App                            0x0000f4e5 +[RMMapContents setPerformExpensiveOperations:] + 97
    15  Test App                            0x0000c295 -[RMMapView resumeExpensiveOperations] + 45
    16  Foundation                          0x000d27f6 __NSFireDelayedPerform + 441
    17  CoreFoundation                      0x01090fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    18  CoreFoundation                      0x01092594 __CFRunLoopDoTimer + 1220
    19  CoreFoundation                      0x00feecc9 __CFRunLoopRun + 1817
    20  CoreFoundation                      0x00fee240 CFRunLoopRunSpecific + 208
    21  CoreFoundation                      0x00fee161 CFRunLoopRunInMode + 97
    22  GraphicsServices                    0x01951268 GSEventRunModal + 217
    23  GraphicsServices                    0x0195132d GSEventRun + 115
    24  UIKit                               0x0036242e UIApplicationMain + 1160
    25  Test App                            0x00002480 main + 102
    26  Test App                            0x00002411 start + 53
    27  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException' 
Owner

vyskocil commented Aug 12, 2011

With Retina display we need double resolution rendered tiles but common tile sources don't provide that, so a hack had been used that shift by one the zoom level, zoom level n+1 tiles are used to render zoom level n, and so on...
But for zoom level 18 there are no zoom level 19 tiles for example with OSM tile source, then the zoom level 18 tiles are used scaled by a factor 2 (same display as with iPhone 3g(s), iPad,..)
To fix the exception you had, I think we must adjust the checks that are done to constrain zoom levels and take care of the retina case.

I would sure like to "vote up" this issue. Duplicate of #159?

Likewise would want to vote up this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment