Tiles Scaled To Dpi on high DPI sources
See original GitHub issueIn current implementation if we have high DPI sources with 512px tiles
private void updateTileSizeForDensity(final ITileSource aTileSource) {
float density = isTilesScaledToDpi() ? getResources().getDisplayMetrics().density : 1;
TileSystem.setTileSize((int) (aTileSource.getTileSizePixels() * density));
}
produce wrong value for tile size. For devices with 3x density tile size become 1536 (512 *3) my solution is this
private void updateTileSizeForDensity(final ITileSource aTileSource) {
int tile_size = aTileSource.getTileSizePixels();
float density = getResources().getDisplayMetrics().density * 256 / tile_size ;
int size = (int) ( tile_size * (isTilesScaledToDpi() ? density : 1));
TileSystem.setTileSize(size);
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
QGIS - exporting open source tiled maps at high dpi or ...
I think this is a output scale issue for those basemaps. The scale on screen is not the same as the scale in...
Read more >How to Adjust High-DPI Scaling in Windows 10 | Digital Trends
1. Click the Notification icon on the Taskbar and select the All Settings tile in the Action Center. Alternatively, click the Start button...
Read more >Retina - HiDPI tiles - MapTiler Support
With MapTiler Engine you can solve this problem by setting the "HiDPI/Retina tiles" option located in the "Output settings" page. retina_1.png.
Read more >dpi dependant scaling - Google Groups
This is already the case, the tile size is computed both from the device scale factor and the user scale factor. The user...
Read more >High DPI images for variable pixel densities - web.dev
In practice, low density images should look the same on new screens as they did on old ones, but compared to the crisp...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is even shorter ’ private void updateTileSizeForDensity(final ITileSource aTileSource) { int size = (int) ( isTilesScaledToDpi() ? getResources().getDisplayMetrics().density * 256 :aTileSource.getTileSizePixels()); TileSystem.setTileSize(size); } ’
But if isTilesScaledToDpi() returns false aTileSource.getTileSizePixels() must be used