Online Tile Based Map downloading and UI Issue

LKHO shared this problem 7 years ago

sorry for the lengthy post.

I know this issue might be quite silly, and most people will not notice if you use the application in normal situation, however the problem still exist.

Once I tried to download the whole world image from Google, just the first few layers only, for example zoom 0-2. then the fastest method to do is zoom out the map to the topmost level, choose "download this screen", and check the first three boxes.

Here I found the bug, the label in the layer chooser shows:

"Area (tiles): -2147202118 tiles, ~~MB"

This is absolutely wrong, I wonder how it calculated the tile count. then I scroll down the zoom list, I found that there is one level (zoom 17) shows -2147....(integer overflow) tiles, and the app automatically checked that for me, since the negative number is smaller than the download limit 10000 tiles. Actually layers starting from zoom16 has got overflow errors since (2^16)^2 > 2^31-1 already. (I suggest using a long instead of integer :D, or simply disable the selection of those layers since no one will select such large area, it will only cause errors)

Despite this layer, the other layers also have calculation errors. the Google map i wrote in the providers list is type 0 Spherical Mercator, that means the total tiles count in one layer is (2^zoom)^2, for zoom 0, the max count should be 1, and zoom1, 2*2=4 so on. But the check list shows that all the layers are calculated with one column and row more than the expected value, such that it displays zoom0 2x2, zoom1 3x3, zoom2 3x5 (i dont know why is 3x5, not 5x5? maybe the app knows how to wrap the x-axis but not y). After that I unchecked the -2147.. layer and continue the download of the first 3 layers. I found that the app will terminate the download and ask me to check the network and sdcard. I was puzzled, so I tried to catch the urls where the app is downloading by redirecting the url to my computer. This reveals that the app is trying to download a non-existing tile z0 x0 y1, if you substitute the numbers to Google`s url and Google will return a 400 bad request. Thus the app asked me to check network connection. This bug will occur whenever your download area reaches the right or bottom edge of the map.

Luckily, there is no errors for just viewing in the map screen. The extra column and row will not be downloaded and the x-axis is wrapped properly.

Another bug: I can choose a download area by dragging a rectangle out of the map. If it is going to wrap the x-axis, then I suggest wrapping the y-axis also.

The attached screen includes the table dump of the online cached sqlitedb, which the app has inserted tiles with extraordinary coordinates values. Although those will not affect the functionality, but will waste space....

Comments (1)


Good day LHKO,

I'm quite satisfied with speed of my bug-fixing ... just two years.

I believe that in current Locus version, most of major problems your wrote about, should be already solved. I just wanted to confirm this and noticed, that Locus incorrectly draw defined rectangle for such huge areas (use geodetic lines instead of straight lines), so this issue will be solved in next version.

Sorry for a longer delay.


Thanks for the notice :) Although it is two years, I saw many improvements in other ways. Im sure the loyal users would not mind waiting for 2 years if they really like the app (like me).