Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Can this output retina images? #9

Open
georgecoltart opened this Issue · 5 comments

4 participants

@georgecoltart

I noticed when on a retina display the source map is @2x but it exports a @1x.
I don't know enough about how canvas works but using this plugin would it be possible to output an @2x image?

thanks for your work on this it's great.

@tmcw
Owner

Yes, though right now I'm pausing all development since #8 is a blocker for this being useful.

@robbiet480

@tmcw Could you point me in the right direction to get retina support going?

@robbiet480

@tmcw Got it, thanks!

@baxford

Hi @tmcw,
first off thanks for the tips about this.
I'm trying to implement the above, but I have a few questions. I am quite new to tiles, so apologies if these are dumb questions.
My understanding is that for a retina image, we need to display the same map but with double the amount of pixels - which is the reason for making the canvas 2x as large, which I have done.
I have tried a couple of ways of getting the higher resolution image, but with only limited success so far:
1 - change tileSize to 512 and adjust the tile calculations accordingly. If this is the correct approach, do I need to adjust the map bounds (from map.getPixelBounds()) or the tileJson bounds (https://github.com/mapbox/leaflet-image/blob/gh-pages/index.js#L70-L72) ?

You also mentioned that the Point math needs to be scaled by 2 - is that in the following lines:
https://github.com/mapbox/leaflet-image/blob/gh-pages/index.js#L85-L96 ?

2 - For each tile that is requested, is it also possible to request 4 tiles at next higher zoom level? This would create problems at the highest zoom level though so I guess it may not be a good option.

Anway, if it's possible to get a few more pointers on which values need adjusting it would be greatly appreciated. I'd be happy to contribute some work back into the project once I have it working.

thanks for any assistance you can provide!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.