route-me/route-me — Issue #159: Retina screen scale when using MBTiles
Author: mishakarpenko
Created: 2012-01-11 11:43:03+00:00
State: open

I've run into some scaling issues using MBTiles source on retina screen:
when running on 480x320 screen the map is ok but on 960x640 it is twice smaller.

I've run into this discussion (relatively fresh, 2 month old) http://groups.google.com/group/route-me-map/browse_thread/thread/6e4fdbb2997fe019. Seems like there was no fix yet.

Topic starter proposed this method for RMMapContents class:

-(float) scaledMetersPerPixel
{
float currScreenScale = (double)([[UIScreen mainScreen] scale] == 2.0) ? 1.0 : 1.0;
float projMetersPerPixel = (float)[mercatorToScreenProjection metersPerPixel];
float scaledMetersPerPixel = projMetersPerPixel*(currScreenScale);
return scaledMetersPerPixel;
}

It does fix the issue. First `currScreenScale` calculation line is meant to set a value close to 1.0 (for example 1.1) in order for tiles to look more smooth when on retina screen.

However if you remove the original division by screenScale it will work the same:

-(float) scaledMetersPerPixel
{
return [mercatorToScreenProjection metersPerPixel];
}

Seems like original `[mercatorToScreenProjection metersPerPixel] / screenScale` code is meant to fix retina issues with some other RM source (sorry, I'm new to route-me).

Please test and fix map scaling with RMMBTilesTileSource.