Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for alternative tiles with different resolutions #6802

Open
zdila opened this issue Sep 13, 2019 · 0 comments
Open

Add support for alternative tiles with different resolutions #6802

zdila opened this issue Sep 13, 2019 · 0 comments

Comments

@zdila
Copy link

zdila commented Sep 13, 2019

Currently it is possible to tell Leaflet to serve tiles of specific resolution by computing it from window.devicePixelRatio and inserting it to TileLayer URL (see #6449 (comment)).

It would be nice to be able to provide list of additional supported scales (eg. [2, 3] for 2x and 3x ) and tiles represented by imgs would then use srcset attribute to tell browser which image to fetch depending on device resolution.

For an example you can see the implementation using react-leaflet in ScaledTileLayer.tsx that extends TileLayer and trivially adds srcset to img returned by createTile. The result can be seen at https://www.freemap.sk/?map=15/48.855595/20.941937&layers=X - view it on HDPI device (eg. mobile phone) or zoom the page in Firefox (Ctrl + +).

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

No branches or pull requests

3 participants