Outdooractive/route-me

Duplicate web tiles fetches

Closed this issue · 6 comments

when the map moved or zoomed, RMMapTiledLayerView:drawLayer gets called twice for the same mapTileLayer and tile area (but different contents), each in its own thread. When the tile is not in memory or disk cache and each thread asks for the same 'tile' at almost the same time, which occurs a lot when moving the screen rapidly (occurs less with zoom) the two thread end up fetching an identical web tile and caching it to disk. I am not sure if any url caches reduces the impact but this behaviour does defeat the caching advantages.

Is this only in the simulator, or also on the device? Because I think I remember that this was a bug in the simulator...

See same symptoms on iPad 2 running 5.1.1. Iam running markermurder sample with osm tilesource and NSLog calls to RMMapTiledLayerView:drawlayer and RMAbstractWebMapSource: imageForTile

Just ran the same on my iPad 4 with 6.0.1. Problem does not show. Also observed with 6.0 that for each tiles there no longer is a duplicate in the other thread. Justin Miller, did indicate in a response to my bug showing this symptom with uiplitviewcontroller (I assumed incorrectly that it was the culprit) that there was (he thought) a apple bug in catilelayer. Too bad, that means if I use this fork, which I believe has some major advantages, that 6.0 is required! Then I have to put up with Apples crappy maps!

Well, I don't think it's that much of an issue. I've been using route-me inside of a UISplitViewController for two years now, and no one has ever complained... Also, most people will be on iOS 6 soon, so IMO you shouldn't worry about such things too much, especially you shouldn't remove cool features from your apps... :)

Ok, that rang a bell. I just saw that I never had problems with this because I use my own implementation of RMAbstractWebMapSource, which (among lots of other stuff specific to our apps) prevents double downloads.

I use a list of tile hashes to keep track of the current downloads. Just subclass RMAbstractWebMapSource in your project and add a list with a lock to check for the current tile hashes:

NSNumber *tileHash = [NSNumber numberWithUnsignedLongLong:RMTileKey(tile)];

I will see that I port my implementation back to route-me when I have some time.

In the develop branch.