Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Can this output retina images? #9

Open
georgecoltart opened this Issue Oct 23, 2013 · 5 comments

Comments

Projects
None yet
4 participants

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.

Contributor

tmcw commented Oct 23, 2013

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

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

Contributor

tmcw commented Aug 18, 2014

@tmcw Got it, thanks!

baxford commented Nov 24, 2014

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