Retina screen scale when using MBTiles #159

Open
mkarp opened this Issue Jan 11, 2012 · 2 comments

Comments

Projects
None yet
3 participants

mkarp commented Jan 11, 2012

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.

Owner

michaeltyson commented Jan 11, 2012

Hi!

I've recently addressed this issue with some contract work I was doing - I've asked the customer whether they consider donating the fixes I made back to the project (I'm sure it'll be fine) - stay tuned.

Any word on this? It would be awesome to have a fix.

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