Osmdroid - display tiles more

I use osmdroid and maps downloaded from OSM to level 16. I was wondering if there is a way to get osmdroid to use tiles from this zoom level, but increase it.

The fact is that the tiles at this level have enough details for me, but are painted on small ones. I saw how some other applications use the same tile levels, but somehow cope with their increase.

thanks

+6
source share
8 answers

You cannot do this without modifying the osmdroid source code. Right now, tiles are displayed with their actual resolution, unless the view is animated between zoom levels. That is, the tiles switch during the animation, and the scale is again set to 1. I tried some tricks to keep the scaling when the user tries to zoom in to the highest level of detail. It works visually, but all the functions that display pixels display coordinates, as well as some interactions when dragging a map, they break. Therefore, this will require a more significant modification of the source. It is doable, but I think that it’s really not worth it if you really do not want to make changes to the project and do it less rudely.

+3
source

The best solution I found for this problem (which I had today) is to change the scaling in the tile source (I use my own version of OpenStreetMap):

final float scale = getBaseContext().getResources().getDisplayMetrics().density; final int newScale = (int) (256 * scale); String[] OSMSource = new String[2]; OSMSource[0] = "http://a.tile.openstreetmap.org/"; OSMSource[1] = "http://b.tile.openstreetmap.org/"; XYTileSource MapSource = new XYTileSource( "OSM", null, 1, 18, newScale, ".png", OSMSource ); map.setTileSource(MapSource); 

Scale variation according to screen density is a relatively good solution. During my testing, some of the images became slightly blurry, but if you zoom out for this unforeseen situation, you will get a very good result.

This is not my BTW solution, I found it among OSMDROID issues on Github . Thank stefangab95

+3
source

I use standalone tiles and just did it to display them at 2x resolution. The important part is the size of 512 pixels, although the tiles have 256.

 myMapView.setTileSource (new XYTileSource ("Mapnik", ResourceProxy.string.offline_mode, 13, 17, 512, ".png", "http://127.0.0.1")); 
+2
source

Cloudmade has high resolution tile support that looks much better on current phones on the market. Look at here:

http://developers.cloudmade.com/projects/tiles/documents

I would use regular tiles for ldpi and mdpi devices and use high-res for hdpi and xhdpi devices.

+1
source

To completely solve your problem, there are two approaches. The first is that you generate or visualize map fragments with your mapnik-like software. The second is the use of real-time vector rendering on a mobile phone such as mapsforge. A configuration file or file style is key in both of these approaches.

+1
source

You can use another tile source, for example M $ Bing. It also has larger street names.

0
source

The workaround that remains in the current OSMdroid working model is to use an image processing package, such as ImageMagick or Photoshop, to create a new set of bitmap fragments with a higher zoom level.

What you need to do is take each current tile (256x256px), resize it, double its size and width, and then cut the image into 4 new tiles. Save each slab according to the naming convention for a new level of scaling. An abstract of the name of the tile map is described here, as well as an easy way to get 4 new names from the original name

-1
source

Source: https://habr.com/ru/post/896190/


All Articles