Repository navigation
Conversation
|
Thanks a bunch for this, @wsnook. I don't have the cycles to get too deep into it right now, but I will have a look, plus it's here for others. I especially appreciate the |
|
Wow, this looks very good indeed. Thank you! I have thrown a highly detailed 75 MB mbtiles map of my city on it and it is handled very well. However, there is no way to disable the base layer because of the way your checks for |
|
@kontextbewusst, I think what you're saying is that you want the map of your city to be the only thing that you see on the screen, and for any tiles which are not included in your MBTiles file (e.g. when you pan past the edge of the city), you want to have a blank background. However, what's actually happening is that Apple's map is showing through around the edges of your city map. Is that correct? I copied the code for the stuff involving I agree that ideally it should be possible to show only the tiles from an MBTiles file without Apple's map behind them, and I think it should be simple enough to do that. However, it would be nice to do it in a way that stays consistent with the existing behavior of the @incanus, do you see an obvious way that I ought to proceed with this? For the moment I can do some testing and figure out what's possible, but I would like to go about this in a way that you'd feel good about merging back into mapbox:master. |
|
@kontextbewusst, My solution was to leave the code related to The trick to getting the behavior you wanted is having the MKTileOverlay's @incanus, |
|
@wsnook Great, thank you very much. Works perfectly fine for me. Is there anything else you would like me to test? So far I have done some basic stuff, like drawing a few polygons on the map and it behaves perfectly fine, just like the regular MKMapView with Apple's vector tiles. |
|
@kontextbewusst Cool, I'm glad to hear that worked for you. As for further testing, the behavior of maps which don't cover the whole world was the main thing I had doubts about, but now that seems to be okay. If you happen to have a Mac Developer program membership, I'm still curious if the MBTiles code works on Mac. The one other question I can think of is whether initialization from a XIB works correctly. Thanks. |
|
I just realized that making |
|
Just FYI @wsnook I've been following along at a cursory level (which goes for #21 as well) but haven't had time to dive into code just yet. Hugely appreciated! And thanks @kontextbewusst for your participation, too. I should be able to hit this before too long. |
|
@incanus, Cool, you're welcome. As I've been digging through all this stuff in the past week, I'm starting to wonder if it might be possible to get MBXMapKit set up with the whole works (slick project setup/install, UTFGrid, mapnik vector tile source, OS X compatibility, sample apps showing how to use it all, docs, etc) with a fairly reasonable level of effort. Compared to having worked a bit last year on the main Mapbox iOS SDK, it sure seems like there's way less friction on the MBXMapKit side... so much less code to wrestle with. |
|
Woah - this looks awesome! I dove into this a bit a while back, but I didn't have time to get very far. You seem to have solved all the key problems. FYI - as I understand it, now that Mavericks is out of beta you do not need to be in the Mac developer program to get at the SDK, it is included in Xcode. Or is the mapping interface limited to only registered developers? |
|
MapKit in OS X is restricted to developer entitlements and apps released in the Mac App Store. |
|
I've begun playing around with MBTiles support in an overlay on top of a base map - great work! The one issue I am running into is that when I "overzoom" that map it becomes possible for me to "slip under" the overlay and see the basemap without the overlay rendered if there are not overlay tiles going deep enough. Consider as an example having a semi-transparent cloud cover MBTiles layer over a MBXMapKit basemap. I'd like to allow deep zooming into the basemap, but the MBTile clouds on top should always be visible - just rendered chunkier as you zoom in. Zooming should never be able to turn a cloudy area clear to the user. I may just be missing something - but right now this jumps out at me in the MBTiles samples. Any ideas on the best way to support this sort of overzooming? |
|
To get the behavior you described, Right now, this is all the pull request MBTiles tile loading code does: When To implement something smarter, you'd need to check the metadata table for the max zoom, and for tiles at zoom levels higher than that, fetch the highest available zoom level, do the math to crop and scale it, then call result(). That type of functionality might need to be configurable so that people could turn it off, although I suppose maybe you could make a decent argument in favor of scale & crop overzoom being a reasonable default behavior. From what I've seen, vanishing layers tend to bother people, but scaling seems to go over pretty well. edit: Actually, it's possible that I might be wrong about a lot of that stuff I just wrote -- it might be way easier. I just remembered that |
|
@wsnook Setting the maximumZ property seems to not change anything. Try setting it to ~15 and zoom in on a map, it will display the same image as when calling result(nil, nil) |
|
@KrauseFx, I just spent some time messing around with this using the For zooming in, what I saw happening was that MKMapView was consistently requesting the current zoom level and 3 zoom levels less than that. It seemed to request the lower zoom level first and scale that up, then it requests the higher zoom level and draws that on top (if the higher zoom level is available). The drawing also seems to work a little differently based on whether you're zooming in or zooming out though. When I zoomed in, MKMapView requested tiles for zoom 2&5, then 6&3, 7&4, 8&5, 9&6, 10&7. For all of those, it shows either the correct size tiles, or scaled up zoom 6 tiles. However, when I zoomed past level 10, and it requested tiles for zoom 11 and zoom 7, the map goes blank. As I zoomed back out...
What that looks like to me is that MKMapKit does reliably provide automatic scaling for two or three zoom levels beyond the end of what a tile source provides, but it doesn't help with larger gaps. For example, an overlay layer that ends at zoom 10 wouldn't work on top of a zoom 16 street map, but it ought to work at zoom 12 as long as you set the overlay's It appears that in order to have the type of over-zooming that you wanted over in #35, and that @radven mentioned here, it would be necessary to implement some kind of fancy caching, cropping, and scaling in |
|
I'm working on implementing overzooming in I'm doing it this way because I'm concerned that merging overzooming in parallel with MBTiles and Maki markers would be a real hassle. My dev branch already has most of the open pull requests merged into it, so it's a lot easier for me to work on new stuff there without creating future merge conflicts. |
|
I'm gonna close this for now as I've incorporated it into a new branch over at #38. |
|
To anybody who's keeping an eye on this or who might happen along later looking for the MBTiles code... @incanus and I have been doing a bunch of coordinating today towards getting things cleaned up and merged for the 0.2.0 milestone. As part of that, we've agreed that some of my code needs to be separated out so that only one issue is being addressed per pull request. Also, I made an unfortunate early decision to write the MBTiles code for this pull request on wsnook/master, and now that's causing me a bit of trouble. For those reasons:
|
|
Wow... I just finished getting wsnook:master cleaned up, and it looks like all the commits for this pull request were actually not affected. GitHub is so cool! |
This worked for some very simple testing on the iOS side. I don't have a Mac Dev program membership to see what happens on the Mac side. I've got things #ifdef'ed pretty well, so I'm optimistic this could be merged without breaking anything for people who haven't turned on MBTiles support, but this could definitely use some further work.
I'm interested in polishing up to the point that it's ready for production, and I think I will need help (code review & testing) in order to do that.
This is for issue #3