mbxmapkit
mbxmapkit copied to clipboard
Issue3 mbtiles hybrid solution
I removed the background queue and loading should be done on the thread calling loadMBTilesDataForPath:...
. I also fixed the example app correctly removing the mbtiles layer when switching to a different overlay.
No matter how often I read http://dev.yorhel.nl/doc/sqlaccess, I am still not sure, that my solution is actually better than @wsnook's original implementation, it only takes less memory for sure. It probably boils down to how often MapKit creates new threads for loading tiles.
@tkrajacic I've been playing with this code in Xcode just now, and it looks good. The mbtiles performance seems solid and it doesn't feel slow. Now that that's working, I've noticed what seemed to be a couple glitches with overzooming and canReplaceMapContent=YES
, but I'm not quite sure if I'm seeing what I think I see. If I can reproduce those issues and understand better what's going on, I'll post more comments.
[edits: fixed a couple typos in my original comment]
@tkrajacic Okay, for the canReplaceMapContent=YES
thing, you might have a look at this comment in particular: https://github.com/mapbox/mbxmapkit/issues/61#issuecomment-36584361 along with the rest of the thread if you're in the mood for some reading. The essence of it is, if boundingMapRect
returns something other than MKMapRectWorld
, it tends to cause real problems. In particular, when you try to make an MBTiles map show up with no Apple map in the background, it won't work right. By returning MKMapRectWorld, it's possible to work around MKMapKit's less than ideal implementation.
I'm not sure what's going on with the overzooming, but at least one time when I zoomed in a bunch, then zoomed back out, the Apple map showed up with no MBTiles over the top. Something odd may be happening with how the zoom limit default values and the if(...)
which checks whether or not to overzoom.
Overall this is great progress. Thanks!
Nice.
@wsnook I have read that thread before but I never really took notice as I kind of never had the problem in my own app. I am actually loading regional mbtiles without Apple's background and it never showed any glitches. I will investigate further if I was just lucky in my app, or if I am doing anything differently. About the overzooming: I think I already mentioned the issue in a pull request before. The problem might have something to do with the mbtiles-file having a level 0 that covers the entire world which will be overzoomed, and the fact that apple does not remove tiles beyond the defined maximum z if they are still in the cache. Since I haven't been able to exactly describe the symptoms yet I need to investigate further. We might also be talking about separate issues.