-
-
Notifications
You must be signed in to change notification settings - Fork 780
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
Support retina/HiDPI raster tiles for non-Mapbox sources #141
Comments
Why not prefix the request URL with |
There is a check for the
But Maplibre is already changing the URL for a predefined list of domains (currently only Mapbox).
This should not be the default and there should be a configuration option to enable this behaviour. |
I suggest to submit a PR to resolve this. I don't think url should be altered. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
I think this would be a useful feature, moreover it makes sense to me to be as compatible as possible to leafletjs for raster layers, so I'll make a pull request adapting their api, that is an explicit {r} which gets replaced in the tile urls. |
This feature is compatible with leafletjs and useful to fetch hidpi tiles for layers that support it.
For people finding this issue, in the end we settled on {ratio} instead of {r} as that feature already existed in maplibre-gl-native. |
If the tile server URL is a Maxbox URL (
isMapboxURL
) and the device has a HiDPI screen (Apple devices: "retina") then the image extension e.g..png
is replaced by@2x.png
.maplibre-gl-js/src/util/mapbox.js
Lines 109 to 120 in ba7bfbc
Adding
@2x
before the image extension seems to be the standard approach in Apple SDKs, map libraries and Web Mercator map tile services, see:It has been discussed to add this feature to the TileJSON spec in mapbox/tilejson-spec#16
However, development on the spec seems to have halted.
I would suggest to allow the above code path for tile servers other than Mapbox either by adding an option to the
Map.setStyle()
method or by adding asupports2x
boolean to the TileJSON.The text was updated successfully, but these errors were encountered: