SD tiles on HD phone (problem with solution and cool side-effect)

Evgeny Kurshev shared this problem 28 days ago
Not processed

=== Problem


fdfb87cbf136e742b53cedb7a817a4d8


This is sqlitedb-file with sd-tiles (256x256) on phone with high screen density.


This sqlitedb-file can be made by Locus on SD-phone and transferred to HD-phone (with same providers.xml, that define different <tileScales> for this map).


Or this sqlitedb-file can be created by MOBAC (or similar) and (!) reinitialized in Locus using map with different <tileScales>).


Or I just can change my phone resolution (built-in feature on, for example, Samsung phones, and I really use it). And after this change I have problems with cache too.


And there is "inversed" problem: sqlitedb-map with HD (512x512) tiles on SD-phone (you can imagine result without screenshot :)


=== Solution


If current on-screen tile size doesn't match stored tile size - Locus need to resize it before drawing.


=== Cool side effect


Now, if I use SD-map on HD-phone, I need to turn on "Magnify all maps" every time I switch to this map (to read texts on map). And turn it off for another (HD) maps.


But with solution above, I can define this map this way:


<url><![CDATA[...path/{z}/{x}/{y}.png]]></url> <!-- without {ts} -->
<tileScales>
  <tileScale dpi="0" multi="1" replace="" ></tileScale>
  <tileScale dpi="320" multi="2" replace="" ></tileScale>
</tileScales>
So, after 320dpi, Locus will download exactly same tile, but draw it resized in 512x512 canvas. This is equivalent to per-map magnifying using providers.xml

Leave a Comment
 
Attach a file