This object is in archive! 

minzoom and maxzoom are swapped in tile database

Patrik Kluba shared this problem 10 years ago
Not a Problem

I have created a tile database with MOBAC to be used by OsmAnd and have choosen the OsmAnd database format for output. Everything is OK. However I`d like to use the same database in Locus. Locus loads it correctly, but in the meantime it changes the schema and the contents, breaking the compatibility with OsmAnd.


The schema change is not that big, and if it is a problem, that should be fixed in OsmAnd. But the data change seems fatal to me, and the database is again OK if I revert it.


MOBAC generates this:


CREATE TABLE info(minzoom,maxzoom);


Locus turns that into:


CREATE TABLE info(minzoom,maxzoom, center_x DOUBLE, center_y DOUBLE, zooms TEXT, provider INTEGER);


That should be OK as the original columns were left intact.


The problem is with the data change:


Original:


sqlite> select * from info;


3|12


Locus turns that to:


sqlite> select * from info;


12|3|45.089035565207|22.5000000002367|12;11;10;9;8;7;6;5;4;3|0


Notice the value swapping between minzoom and maxzoom. Is it intentional? What do `minzoom` and `maxzoom` mean to Locus?

Replies (3)

photo
0

Hello Patrik,


I think that it`s important to know, that as I know, first who came with this "SQLite format", was quite old application RMaps. It`s a format I use in Locus. If OsmAnd has own format with different values, it`s really not my problem and I`ll not change anything here, sorry.


Second side of coin. Min zoom level is in my eyes "World level". Max zoom is "Streets".


Zoom value on OpenStreetMap server is counted from 0 (world) to 18 (streets). Quite logical. Zoom level in SQLite used in Locus is counted from 17 (world) to -1 (streets). Don`t ask me why (it was in this way in RMaps app. So Zoom level is counter as 17 - OSM zoom value. In this case, values 12|3 in SQLite updated by Locus make sense

photo
0

Hi Menion,


Fine. But then Locus should renumber the tiles in the database (which is a no go for an 1GB database on the phone), as it breaks everything by just swapping minzoom and maxzoom values. Or better it should not touch the database at all, optionally reporting that the database is not supported, if maxzoom>minzoom.


By the way, I have checked the OsmAnd code, and it does support BigPlanet/RMaps format (so I`ll be using this in the future), with a catch. To differentiate the format from the "native" format, an extra column is added to the `info` table. The column`s name is `tilenumbering`, and it containts the string `BigPlanet`, if the zoom works inverse.


Does Locus keep that column, if it is present? If not, could you please add support for that?

photo
0

why renumber?


I`ve downloaded Mobac, selected OSMand SQLite map format, downloaded small map and in database isno information like "BigPlanet". Also map is loaded in Locus without problems, but can confirm that Locus switch min/max zoom values.


And now tell me, where is problem? You create map for OsmAnd and no one may confirm that it will work in different apps. Also from downloaded map is not clear for which program it comes, so I cannot preserve old values when I need to use correct Locus values. Locus use same format for almost three years and till now, there were no problem. From my point of view, "minZoom" should be zoom for World level, "maxZoom" for a street level. That`s how Locus works.


Sorry, but I cannot help here

Replies have been locked on this page!